Difference between revisions of "Linux crypt"
From Teknologisk videncenter
(Created page with "<source lang=c> #include <stdio.h> #define _XOPEN_SOURCE →See feature_test_macros(7): #include <unistd.h> //#define _GNU_SOURCE #include <crypt.h> int main( void )...") |
m |
||
Line 8: | Line 8: | ||
int main( void ) { | int main( void ) { | ||
char *tp; | char *tp; | ||
− | |||
tp = crypt("cisco","$1$uUpN"); | tp = crypt("cisco","$1$uUpN"); | ||
if ( tp == 0 ) { | if ( tp == 0 ) { |
Revision as of 16:07, 28 September 2019
#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);
}
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/