3 import qualified Data.ByteString.Char8 as BS
4 import qualified Data.ByteString.Lazy as BL
10 let fileRemote = "fasljlajljalfjlajfasdjkg;fdk;kqpitpk;k;asdk;kg;adskg"
11 fileLocal = "ljljalsjdgljadslfjlasjdfqporiuqplsadljfaljdf"
13 -- generate signatures at block boundaries for the local file and send it to remote.
14 fileLocalSigs = fileSignatures (BL.fromStrict (BS.pack fileLocal)) blockSize
15 -- at remote, take the signatures from the other size and generate instructions.
16 insns = genInstructions fileLocalSigs blockSize (BL.fromStrict (BS.pack fileRemote))
17 -- at the local side, take those instructions and apply to fileLocal
18 fileLocalNew = recreate (BL.fromStrict (BS.pack fileLocal)) blockSize insns
19 putStrLn $ "remote: " ++ fileRemote
20 putStrLn $ "local: " ++ fileLocal
21 BS.putStrLn $ (BS.pack "recreated: ") `BS.append` (BL.toStrict fileLocalNew)