[Haskell-beginners] State help request

Joe xe4mxee at gmail.com
Sun Dec 9 23:39:58 CET 2012


Thanks for your help, not sure why I'd put the key in the State. The
execState and pointfree-ing made it a lot nicer. You're right on the
foldr/flip, but I wasn't zeroing the i & j parts of the PRGA, so now I
have:


ksa' :: Key -> PRGA
ksa' key = (prga,0,0) -- have to zero
   where (prga,_,_) = foldr (execState . ksaStep' key) (permId,0,0)
[255,254..0]


I need the [255,254..0] since it has to count up, and the "where" to
set the zeros. I'm not sure if those are worth fixing, or what can be
done to make either of those any better. Any suggestions would be
appreciated.

As for running, I was just running "pwCrypt "key" "plaintext"" in ghci
and checking against the expected keystream/ciphertext.

> And man I just want to say how jealous I am.  I wish I could go to a ny haskell group :(.

There's a meeting this week! Edward Kmett and his lens library. Last
month's had a good crowd, very friendly.



More information about the Beginners mailing list