Re: MD5 algorithm
From: Wojtek Walczak (gminick@hacker.pl)Date: 03/29/02
- Next message: Wojtek Walczak: "Re: port 80 scans"
- Previous message: RainbowHat: "Re: URGENT: Zer0Kit start-up script by Virus (Virusel,Viruzzel)"
- In reply to: dwij: "MD5 algorithm"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: gminick@hacker.pl (Wojtek Walczak) Date: Fri, 29 Mar 2002 12:37:14 +0000 (UTC)
** Since micro$oft is stupid it doesn't mean
** that you should be stupid too - do NOT toppost.
Dnia 28 Mar 2002 02:57:49 -0800, dwij napisał(a):
>main()
>{
> const unsigned char *d = "password";
> unsigned char *md;
> unsigned long n;
> MD5_CTX *c;
> MD5_Init(c);
> MD5_Final(md,c);
> md = (unsigned char *)malloc(100);
> MD5(d,n,md);
> printf("%s",md);
>}
ufff... your code was hard to debug ;)
even now i'm not sure if it works properly(looks like it's not)
(because i haven't been using openssl for a year or so...)
your code after a little modification looks like:
---
#include <stdio.h>
#include <openssl/md5.h>
#include <stdlib.h>
int main(void)
{
const unsigned char *d = "password";
unsigned char md[1000];
unsigned long n;
MD5_CTX c;
MD5_Init(&c);
MD5_Final(md,&c);
MD5(d,n,md);
printf("%x\n",md);
return 0;
}
---
and to compile it you should use that command (works on slack8.0):
gcc -Wall md5.c -lssl
with openssl headers installed
if you can, use (i.e.)Python instead of C, it's a lot nicer,
simple example:
---
#!/usr/local/bin/python
import md5
m = md5.new()
m.update("password")
print m.hexdigest()
---
HTH
--
[ Wojtek gminick Walczak ][ http://hacker.pl/gminick/ ]
[ gminick (at) hacker.pl ][ gminick (at) klub.chip.pl ]
- Next message: Wojtek Walczak: "Re: port 80 scans"
- Previous message: RainbowHat: "Re: URGENT: Zer0Kit start-up script by Virus (Virusel,Viruzzel)"
- In reply to: dwij: "MD5 algorithm"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|