Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

cprng-aes and crypto-random replacement #13

Open
ibotty opened this issue Jun 15, 2015 · 3 comments
Open

cprng-aes and crypto-random replacement #13

ibotty opened this issue Jun 15, 2015 · 3 comments

Comments

@ibotty
Copy link

ibotty commented Jun 15, 2015

Hi,

should Crypto.Random.AESCtr be ported to cryptonite or is chacha the proposed replacement?

What about the urandom generator?

Thanks

@vincenthz
Copy link
Member

ChaCha is probably a good replacement, but I'm planning to add AESCtr back. it was just thrown under the bus for lack of time. For the urandom generator, yes it's a good idea to add back too.

@ibotty
Copy link
Author

ibotty commented Jun 17, 2015

After filing the issue I came to understand that the MonadRandom IO instance uses a mix of all entropy sources including urandom. I would be very pleased to have a rng where you can specify what EntropyBackend to use though.

What do you think about the following monad transformer

data SystemRNG e m a = SystemRNG m a

instance EntropySource e => MonadRandom (SystemRNG e)

with a suitable

runSystemRNG :: EntropySource e => proxy e -> SystemRNG e m a -> m a

(or maybe lacking the proxy argument).

@vincenthz
Copy link
Member

Some of this is probably a good idea, but I don't think distinguishing the SystemRNG at the type level and exposing the EntropySource is useful. It would make more sense to expose a simple ADT that can combine the EntropySource the way it want, e.g.:

data EntropyType = Cpu | System ...

getEntropyFrom :: EntropyType -> ...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants