[Haskell-cafe] Annoyed at System.Random

2012-05-03 Thread Thomas DuBuisson
Ryan, I've grown annoyed at System.Random enough (specifically, StdGen). How much, if any, pushback would there be if I put together a FFI binding to a C AES-CTR based RNG. There are many advantages: 0) The API wouldn't have to change (though some parts should, and some change is already planned)

Re: [Haskell-cafe] Annoyed at System.Random

2012-05-03 Thread Ryan Newton
Hi Thomas, Personally, I would love to see that happen. It seems like the best way to make split acceptable. Is Brian Gladman's C implementation still best in class? In my tests even without AESNI it could exceed the traditional System.Random in performance ( https://github.com/rrnewton/intel-a

Re: [Haskell-cafe] Annoyed at System.Random

2012-05-03 Thread Ertugrul Söylemez
Thomas DuBuisson wrote: > I've grown annoyed at System.Random enough (specifically, StdGen). > How much, if any, pushback would there be if I put together a FFI > binding to a C AES-CTR based RNG. There are many advantages: > > [...] > > I'd be tempted to pull in the 'entropy' package for seedin

Re: [Haskell-cafe] Annoyed at System.Random

2012-05-03 Thread Thomas DuBuisson
On Thu, May 3, 2012 at 5:26 PM, Ertugrul Söylemez wrote: > Thomas DuBuisson wrote: > >> I've grown annoyed at System.Random enough (specifically, StdGen). >> How much, if any, pushback would there be if I put together a FFI >> binding to a C AES-CTR based RNG.  There are many advantages: >> >> [.

Re: [Haskell-cafe] Annoyed at System.Random

2012-05-03 Thread Ertugrul Söylemez
Thomas DuBuisson wrote: > Vincent has done great work for Haskell+Crypto so I think he knows I > mean nothing personal when I say cprng-aes has the right idea done the > wrong way. Why a new effort vs Vincent's package? > > 1. cprng-aes is painfully slow. > 2. It doesn't use NI instructions (or

Re: [Haskell-cafe] Annoyed at System.Random

2012-05-03 Thread Thomas DuBuisson
On May 3, 2012 5:49 PM, "Ertugrul Söylemez" wrote: > Thomas DuBuisson wrote: > > > Vincent has done great work for Haskell+Crypto so I think he knows I > > mean nothing personal when I say cprng-aes has the right idea done the > > wrong way. Why a new effort vs Vincent's package? > > > > 1. cpr

Re: [Haskell-cafe] Annoyed at System.Random

2012-05-04 Thread Vincent Hanquez
On 05/04/2012 01:35 AM, Thomas DuBuisson wrote: Vincent has done great work for Haskell+Crypto so I think he knows I mean nothing personal when I say cprng-aes has the right idea done the wrong way. Why a new effort vs Vincent's package? 1. cprng-aes is painfully slow. when using the haskell A

Re: [Haskell-cafe] Annoyed at System.Random

2012-05-04 Thread Vincent Hanquez
On 05/04/2012 04:56 AM, Thomas DuBuisson wrote: On May 3, 2012 5:49 PM, "Ertugrul Söylemez" mailto:e...@ertes.de>> wrote: Thomas DuBuisson mailto:thomas.dubuis...@gmail.com>> wrote: I can't really tell whether the first two points are true. Feel free to investigate it yourself, I've

Re: [Haskell-cafe] Annoyed at System.Random

2012-05-04 Thread Ryan Newton
> > 1. cprng-aes is painfully slow. >> > when using the haskell AES implementation yes. with AESNI it fly, and even > more when > i'll have time to chunk the generation to bigger blocks (says 128 AES > block at a time) One data-point -- in "intel-aes" I needed to do bigger blocks to get decent pe

Re: [Haskell-cafe] Annoyed at System.Random

2012-05-04 Thread Ryan Newton
> > My end goal is to have the user use transparently the fastest > implementation available to their architecture/cpu providing they use the > high level module. I've uploaded the cpu package which allows me to detect > at runtime the aes instruction (and the architecture), but i've been > distrac

Re: [Haskell-cafe] Annoyed at System.Random

2012-05-04 Thread Thomas DuBuisson
Vincent uses gcc header files to get the AES instructions: Header files of: #include #include And later calls of: x = _mm_aesenc_si128(m, K1); But currently you must know you have AESNI and use a flag: cabal install cryptocipher -faesni But if you are wrong: Illegal i

Re: [Haskell-cafe] Annoyed at System.Random

2012-05-04 Thread Vincent Hanquez
On 05/04/2012 02:37 PM, Ryan Newton wrote: My end goal is to have the user use transparently the fastest implementation available to their architecture/cpu providing they use the high level module. I've uploaded the cpu package which allows me to detect at runtime the aes instruc

Re: [Haskell-cafe] Annoyed at System.Random

2012-05-04 Thread Brandon Allbery
On Fri, May 4, 2012 at 10:11 AM, Vincent Hanquez wrote: > For the language, i think assembly is a no-no with cabal, as such it need > to be embedded in gcc inline assembly if you want to have something that > works (unless there's a secret way to run assembler in a portable fashion > in cabal). >

Re: [Haskell-cafe] Annoyed at System.Random

2012-05-04 Thread Vincent Hanquez
On 05/04/2012 02:33 PM, Ryan Newton wrote: 1. cprng-aes is painfully slow. when using the haskell AES implementation yes. with AESNI it fly, and even more when i'll have time to chunk the generation to bigger blocks (says 128 AES block at a time) One data-point -- in "

Re: [Haskell-cafe] Annoyed at System.Random

2012-05-04 Thread Vincent Hanquez
On 05/04/2012 03:05 PM, Thomas DuBuisson wrote: Vincent uses gcc header files to get the AES instructions: Header files of: #include #include And later calls of: x = _mm_aesenc_si128(m, K1); But currently you must know you have AESNI and use a flag: cabal install crypto

Re: [Haskell-cafe] Annoyed at System.Random

2012-05-04 Thread Vincent Hanquez
On 05/04/2012 03:18 PM, Brandon Allbery wrote: On Fri, May 4, 2012 at 10:11 AM, Vincent Hanquez > wrote: For the language, i think assembly is a no-no with cabal, as such it need to be embedded in gcc inline assembly if you want to have something that works (un