/* $OpenLDAP$ */ /* * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved. * COPYING RESTRICTIONS APPLY, see COPYRIGHT file */ #include "portable.h" #include #include #include #include #include #include #include #include #include "lutil.h" char *hash[] = { "{SMD5}", "{SSHA}", "{MD5}", "{SHA}", NULL }; static struct berval pw[] = { { sizeof("secret")-1, "secret" }, { sizeof("binary\0secret")-1, "secret\0binary" }, { 0, NULL } }; int main( int argc, char *argv[] ) { int i, j, rc; struct berval *passwd; for( i= 0; hash[i]; i++ ) { for( j = 0; pw[j].bv_len; j++ ) { passwd = lutil_passwd_generate( &pw[j], hash[i] ); rc = lutil_passwd( passwd, &pw[j], NULL ); printf("%s (%d): %s (%d) %s\n", pw[j].bv_val, pw[j].bv_len, passwd->bv_val, passwd->bv_len, rc == 0 ? "OKAY" : "BAD" ); } } return EXIT_SUCCESS; }