Created
January 18, 2021 20:55
-
-
Save exarkun/cb9281127eadae6875c24933c9c4c976 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chk_encrypt :: AESKey128 -> (Integer -> IO B.ByteString) -> IO (Integer -> IO B.ByteString) | |
chk_encrypt key read_cleartext = do | |
ivref <- newIORef zeroIV | |
return $ \len -> do | |
cleartext <- read_cleartext len | |
iv <- readIORef ivref | |
let (ciphertext, new_iv) = ctr key iv cleartext | |
writeIORef ivref new_iv | |
return ciphertext |
Author
exarkun
commented
Jan 18, 2021
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment