diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2001-05-04 13:05:48 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2001-05-04 13:05:48 +0000 |
commit | 8f82a8e581e02a32aa97069052cdfccfc522b930 (patch) | |
tree | 06edca357d0f97648488fad490676d3b61b6553e /src/crypt.c | |
parent | d93f1d1688a500a822d1d7793cc8e60563436db1 (diff) | |
download | gnutls-8f82a8e581e02a32aa97069052cdfccfc522b930.tar.gz |
More adds for SRP - SRPSHA1 and bcrypt
Diffstat (limited to 'src/crypt.c')
-rw-r--r-- | src/crypt.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/crypt.c b/src/crypt.c index d86752a8d3..e574d8551a 100644 --- a/src/crypt.c +++ b/src/crypt.c @@ -61,12 +61,31 @@ int main(int argc, char** argv) { gaainfo info; char* passwd; char* cr=NULL; +int crypt, salt; if ( gaa(argc, argv, &info) != -1) { fprintf(stderr, "Error in the arguments.\n"); return -1; } - + + salt = info.salt; + + if(info.crypt==NULL) crypt = SRPSHA1_CRYPT; + else { + if (strcasecmp( info.crypt, "bcrypt")==0) { + crypt = BLOWFISH_CRYPT; + if (salt==0) salt = 6; /* cost is 6 */ + } + else if (strcasecmp( info.crypt, "srpsha")==0) { + crypt = SRPSHA1_CRYPT; + if (salt==0) salt = 16; /* 16 bytes salt */ + } + else { + fprintf(stderr, "Unknown algorithm\n"); + return -1; + } + } + passwd = getpass("Enter password: "); if (info.passwd != NULL) { @@ -75,7 +94,8 @@ char* cr=NULL; return 0; } - cr = gnutls_crypt( info.username, passwd, BLOWFISH_CRYPT); + + cr = gnutls_crypt( info.username, passwd, crypt, salt); printf("%s:%s\n", info.username, cr); free(cr); return 0; |