www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - MD5, SHA1, SHA256, CRC32

reply Russel Winder <russel winder.org.uk> writes:
I'm in need of calculating these numbers as part of a program.  Java,
Python, Go, all provide these algorithms "out of the box".  From what I
can see D does not.  There is a crc32 module and a std/md5 module but...

Have I just missed something?

Thanks.

--=20
Russel.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder ekiga.n=
et
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
Apr 10 2012
next sibling parent Walter Bright <newshound2 digitalmars.com> writes:
On 4/10/2012 2:25 AM, Russel Winder wrote:
 I'm in need of calculating these numbers as part of a program.  Java,
 Python, Go, all provide these algorithms "out of the box".  From what I
 can see D does not.  There is a crc32 module and a std/md5 module but...

 Have I just missed something?
The crc32 and md5 are two of them. Nobody has done the others. I know the md5 one is a straightforward translation from the C version. The others could be done the same way. Also, there's: https://github.com/D-Programming-Deimos/openssl
Apr 10 2012
prev sibling next sibling parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
There's a few of us who have written our own
implementations of these, but as far as I know
none of them are considered good enough for
stdlib.


But if you just want something you can use now,
here's mine for sha:

https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff/blob/master/sha.d

assert(hashToString(SHA1("abc")) == 
"a9993e364706816aba3e25717850c26c9cd0d89d");
assert(hashToString(SHA256("abc")) == 
"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad");
Apr 10 2012
parent reply Piotr Szturmaj <bncrbme jadamspam.pl> writes:
Adam D. Ruppe wrote:
 There's a few of us who have written our own
 implementations of these, but as far as I know
 none of them are considered good enough for
 stdlib.


 But if you just want something you can use now,
 here's mine for sha:

 https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff/blob/master/sha.d
And here's mine: https://github.com/pszturmaj/phobos/blob/master/std/crypto/hash/sha.d (yeah, I need to move it to a new branch)
Apr 10 2012
parent reply Manu <turkeyman gmail.com> writes:
On 10 April 2012 20:41, Piotr Szturmaj <bncrbme jadamspam.pl> wrote:

 Adam D. Ruppe wrote:

 There's a few of us who have written our own
 implementations of these, but as far as I know
 none of them are considered good enough for
 stdlib.


 But if you just want something you can use now,
 here's mine for sha:

 https://github.com/adamdruppe/**misc-stuff-including-D-**
 programming-language-web-**stuff/blob/master/sha.d<https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff/blob/master/sha.d>
And here's mine: https://github.com/pszturmaj/** phobos/blob/master/std/crypto/**hash/sha.d<https://github.com/pszturmaj/phobos/blob/master/std/cryp o/hash/sha.d>(yeah, I need to move it to a new branch)
I've needed these the past few days too.. what makes this one unsuitable for std? I see you've put it in the std namespace ;) Is there something holding it back?
Apr 10 2012
next sibling parent Piotr Szturmaj <bncrbme jadamspam.pl> writes:
Manu wrote:
 On 10 April 2012 20:41, Piotr Szturmaj <bncrbme jadamspam.pl
     And here's mine:
     https://github.com/pszturmaj/__phobos/blob/master/std/crypto/__hash/sha.d
     <https://github.com/pszturmaj/phobos/blob/master/std/crypto/hash/sha.d>
     (yeah, I need to move it to a new branch)


 I've needed these the past few days too.. what makes this one unsuitable
 for std? I see you've put it in the std namespace ;)
 Is there something holding it back?
Incompleteness :) I'm currently working on a commercial project and I don't have much time for this. http://prowiki.org/wiki4d/wiki.cgi?CryptoDevel (any help will be appreciated)
Apr 10 2012
prev sibling parent Kai Nacke <kai redstar.de> writes:
On 10.04.2012 20:12, Manu wrote:
 On 10 April 2012 20:41, Piotr Szturmaj <bncrbme jadamspam.pl
 <mailto:bncrbme jadamspam.pl>> wrote:

     Adam D. Ruppe wrote:

         There's a few of us who have written our own
         implementations of these, but as far as I know
         none of them are considered good enough for
         stdlib.


         But if you just want something you can use now,
         here's mine for sha:

         https://github.com/adamdruppe/__misc-stuff-including-D-__programming-language-web-__stuff/blob/master/sha.d
         <https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff/blob/master/sha.d>


     And here's mine:
     https://github.com/pszturmaj/__phobos/blob/master/std/crypto/__hash/sha.d
     <https://github.com/pszturmaj/phobos/blob/master/std/crypto/hash/sha.d>
     (yeah, I need to move it to a new branch)


 I've needed these the past few days too.. what makes this one unsuitable
 for std? I see you've put it in the std namespace ;)
 Is there something holding it back?
Just see the discussion here: https://github.com/D-Programming-Language/phobos/pull/221 Kai
Apr 11 2012
prev sibling parent reply Ellery Newcomer <ellery-newcomer utulsa.edu> writes:
you might see if the tango d2 port impls are working

https://github.com/SiegeLord/Tango-D2/tree/d2port/tango/util/digest

On 04/10/2012 04:25 AM, Russel Winder wrote:
 I'm in need of calculating these numbers as part of a program.  Java,
 Python, Go, all provide these algorithms "out of the box".  From what I
 can see D does not.  There is a crc32 module and a std/md5 module but...

 Have I just missed something?

 Thanks.
Apr 10 2012
parent "Regan Heath" <regan netmail.co.nz> writes:
On Tue, 10 Apr 2012 20:34:22 +0100, Ellery Newcomer  
<ellery-newcomer utulsa.edu> wrote:

 you might see if the tango d2 port impls are working

 https://github.com/SiegeLord/Tango-D2/tree/d2port/tango/util/digest
Those were mine (originally) and I am happy to contribute the original versions to anyone who needs them. Regan -- Using Opera's revolutionary email client: http://www.opera.com/mail/
Apr 11 2012