Skip to content

Instantly share code, notes, and snippets.

@sellout
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sellout/73355d6e7719f6475742 to your computer and use it in GitHub Desktop.
Save sellout/73355d6e7719f6475742 to your computer and use it in GitHub Desktop.
class Cipher c where
bitsPerChunk : Nat
class Cipher k => StreamCipher k where
generateKeystream : k -> Stream (Bits bitsPerChunk)
instance Cipher (AllegedRivestCipher4 n) where
bitsPerChunk = 8
instance StreamCipher (AllegedRivestCipher4 n) where
generateKeystream (ARC4 key) = PGRA 0 0 (KSA key)
-- When elaborating type of Data.Crypto.Encryption.StreamCipher.AllegedRivestCipher4 n instance of Data.Crypto.Encryption.StreamCipher.StreamCipher, method generateKeystream:
-- Can't resolve type class Data.Crypto.Encryption.SymmetricCipher.Cipher c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment