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"
12 -- generate signatures at block boundaries for the local file and send it to remote.
13 fileLocalSigs = fileSignatures (BL.fromStrict (BS.pack fileLocal)) 5
14 -- at remote, take the signatures from the other size and generate instructions.
15 insns = genInstructions fileLocalSigs 5 (BL.fromStrict (BS.pack fileRemote))
16 -- at the local side, take those instructions and apply to fileLocal
17 fileLocalNew = recreate (BL.fromStrict (BS.pack fileLocal)) 5 insns
18 putStrLn $ "remote: " ++ fileRemote
19 putStrLn $ "local: " ++ fileLocal
20 BS.putStrLn $ (BS.pack "recreated: ") `BS.append` (BL.toStrict fileLocalNew)