Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
27
Task/MD4/PARI-GP/md4-1.parigp
Normal file
27
Task/MD4/PARI-GP/md4-1.parigp
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#include <pari/pari.h>
|
||||
#include <openssl/md4.h>
|
||||
|
||||
#define HEX(x) (((x) < 10)? (x)+'0': (x)-10+'a')
|
||||
|
||||
/*
|
||||
* PARI/GP func: MD4 hash
|
||||
*
|
||||
* gp code: install("plug_md4", "s", "MD4", "<library path>");
|
||||
*/
|
||||
GEN plug_md4(char *text)
|
||||
{
|
||||
char md[MD4_DIGEST_LENGTH];
|
||||
char hash[sizeof(md) * 2 + 1];
|
||||
int i;
|
||||
|
||||
MD4((unsigned char*)text, strlen(text), (unsigned char*)md);
|
||||
|
||||
for (i = 0; i < sizeof(md); i++) {
|
||||
hash[i+i] = HEX((md[i] >> 4) & 0x0f);
|
||||
hash[i+i+1] = HEX(md[i] & 0x0f);
|
||||
}
|
||||
|
||||
hash[sizeof(md) * 2] = 0;
|
||||
|
||||
return strtoGENstr(hash);
|
||||
}
|
||||
3
Task/MD4/PARI-GP/md4-2.parigp
Normal file
3
Task/MD4/PARI-GP/md4-2.parigp
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
install("plug_md4", "s", "MD4", "~/libmd4.so");
|
||||
|
||||
MD4("Rosetta Code")
|
||||
Loading…
Add table
Add a link
Reference in a new issue