crypto.mod

BlitzMax Forums/Brucey's Modules/crypto.mod

jkrankie(Posted 2009) [#1]
can this do sha1 encryption? wikipedia reckons that the c++ crypto library can, but i can't see it in your docs?

Cheers
Charlie


Brucey(Posted 2009) [#2]
I haven't implemented any of the digest functionality. I take it this would be useful to you?
:-)


Artemis(Posted 2009) [#3]
sha is not encryption but hashing ;-)


jkrankie(Posted 2009) [#4]
Yes, very useful. Doug (the guy who's doing the web stuff for my new game) has suggested we use sha1 to encrypt stuff being sent to the database. Quite when the database will be ready for testing is still unknown (although most likely this month...), but it would be really cool to have this available.

Cheers
Charlie


jkrankie(Posted 2009) [#5]
OK, hash stuff being sent to the database ;)

Cheers
Charlie


Brucey(Posted 2009) [#6]
Yeah, I've only done the crypto stuff of the library, but I suppose it would be more complete to add the digest stuff too.


jkrankie(Posted 2009) [#7]
If you would have a go that would be really good of you. I could send a few pints your way if that would help :)

Cheers
Charlie


Brucey(Posted 2009) [#8]
Updated SVN version of BaH.Crypto with new Digest functions.

See digest.bmx example :-)

In theory one could wrap up the basic example into a standalone function for each kind... like sha1(), taking a string and returning a hex string, with all the bytes and conversions done in there.
Maybe I should add those too...


Brucey(Posted 2009) [#9]
Okay. I've created helper functions for all the Message Digests.

Now you can call things like :
Print SHA1("Hello!")

However, for more complex usage - like getting the hash for a large file - you should use the main API, where you can pass in chunks of data to DigestUpdate(), rather than loading it all into RAM first.

The following functions are available :

MD2, MD5, SHA, SHA1, DSS, DSS1, MDC2 (not Windows), and RIPEMD160.

:o)


jkrankie(Posted 2009) [#10]
Brucey, that's aces! i'll give it a whirl tomorrow when i get back.

Cheers
Charlie


johnnyfreak(Posted 2009) [#11]
Brucey are SHA, MD5 only via SVN?


Brucey(Posted 2009) [#12]
They are until I create a new release.

Give me 10 mins... I need to test it on Linux first. :-)


johnnyfreak(Posted 2009) [#13]
ok.

Anyway at what URI can i get crypto.mod?

(Your modules are very useful, i could change language without)


Brucey(Posted 2009) [#14]
Main site is here : http://maxmods.googlecode.com

Click on the Downloads tab for list of releases.... you'll be wanting crypto_1_01 when it is ready.


johnnyfreak(Posted 2009) [#15]
Sorry, i written wrong. I wanted to know SVN uri for crypto. Your site is well known ;)


Brucey(Posted 2009) [#16]
Oh... :-)

http://maxmods.googlecode.com/svn/trunk/


Be warned... you may prefer to choose specific modules, rather than download them all - there are *many* there.


Brucey(Posted 2009) [#17]
Anyhoo... I've put up a new release 1.01, which includes the new digest functions.


johnnyfreak(Posted 2009) [#18]
thanks


johnnyfreak(Posted 2009) [#19]
I downloaded the new release 1.01 and (on Windows) it works (after installing OpenSSL.

I tested this on my pc and it works fine:
Framework BaH.Crypto
Import BRL.StandardIO

Print SHA1("ciao")

End


After packing this executable and libeay32.dll on the same folder, i've sent it to a friend for testing, but it doesn't work!

The program can't find libeay32.dll even if it's on the same folder.
Have i missed something?

(Sorry if ii do english mistakes)