www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - MD5, SHA1, SHA256, CRC32

reply Russel Winder <russel winder.org.uk> writes:
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

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
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 next sibling parent Manu <turkeyman gmail.com> writes:
--20cf302ef74c08eb9e04bd5712e6
Content-Type: text/plain; charset=UTF-8

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? --20cf302ef74c08eb9e04bd5712e6 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div class=3D"gmail_quote">On 10 April 2012 20:41, Piotr Szturmaj <span dir= =3D"ltr">&lt;<a href=3D"mailto:bncrbme jadamspam.pl">bncrbme jadamspam.pl</= a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0= 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <div class=3D"im">Adam D. Ruppe wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"> There&#39;s a few of us who have written our own<br> implementations of these, but as far as I know<br> none of them are considered good enough for<br> stdlib.<br> <br> <br> But if you just want something you can use now,<br> here&#39;s mine for sha:<br> <br> <a href=3D"https://github.com/adamdruppe/misc-stuff-including-D-programming= -language-web-stuff/blob/master/sha.d" target=3D"_blank">https://github.com= /adamdruppe/<u></u>misc-stuff-including-D-<u></u>programming-language-web-<= u></u>stuff/blob/master/sha.d</a><br> </blockquote> <br></div> And here&#39;s mine: <a href=3D"https://github.com/pszturmaj/phobos/blob/ma= ster/std/crypto/hash/sha.d" target=3D"_blank">https://github.com/pszturmaj/= <u></u>phobos/blob/master/std/crypto/<u></u>hash/sha.d</a> (yeah, I need to= move it to a new branch)<br> </blockquote></div><br><div>I&#39;ve needed these the past few days too.. w= hat makes this one unsuitable for std? I see you&#39;ve put it in the std n= amespace ;)<br></div><div>Is there something holding it back?</div> --20cf302ef74c08eb9e04bd5712e6--
Apr 10 2012
prev sibling next sibling parent 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
prev sibling 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