Last active
August 29, 2015 14:00
-
-
Save sellout/11390058 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
confoundMessage : (StreamCipher k, Serializable i, Serializable o) => | |
k -> i -> o | |
confoundMessage key message = | |
let encodedMsg = encode message | |
in decode (zipWith xor | |
(Prelude.Stream.take (length encodedMsg) | |
(generateKeystream key)) | |
encodedMsg) | |
-- When elaborating an application of function Prelude.Vect.zipWith: | |
-- Unifying n and length (encode message) would lead to infinite value | |
------------------ | |
-- second attempt: | |
confoundMsg : StreamCipher k => k -> Vect m (Bits n) -> Vect m (Bits n) | |
confoundMsg {m=m} key = zipWith xor (take m (generateKeystream key)) | |
confoundMessage : (StreamCipher k, Serializable i, Serializable o) => | |
k -> i -> o | |
confoundMessage key message = decode (confoundMsg key (encode message)) | |
-- ./Data/Crypto/Encryption/StreamCipher.idr:27:17:Incomplete term decode (confoundMsg key (encode message)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment