Linux crypt
From Teknologisk videncenter
#include <stdio.h>
#define _XOPEN_SOURCE /* See feature_test_macros(7) */
#include <unistd.h>
//#define _GNU_SOURCE
#include <crypt.h>
int main( void ) {
char *tp;
tp = crypt("cisco","$1$uUpN");
if ( tp == 0 ) {
perror("Av: ");
return(0);
}
printf("%s\n",tp);
return(0);
}
Remember to compile with -lcrypt
- When run:
a:~/bin$ gcc crypt.c -o crypt -lcrypt
a:~/bin$ ./crypt
$1$uUpN$JSmJL9.bdbLHahGFx.BLe/
Running config from a Cisco router with password cisco:
enable secret 5 $1$uUpN$JSmJL9.bdbLHahGFx.BLe/