- jakob@cvs.openbsd.org 2001/03/11 15:13:09
[key.c] cleanup & shorten some var names key_fingerprint_bubblebabble.
This commit is contained in:
parent
a8a73e62ed
commit
cbe3ad2f70
|
@ -11,6 +11,9 @@
|
||||||
[ssh-keygen.1 ssh-keygen.c]
|
[ssh-keygen.1 ssh-keygen.c]
|
||||||
print both md5, sha1 and bubblebabble fingerprints when using
|
print both md5, sha1 and bubblebabble fingerprints when using
|
||||||
ssh-keygen -l -v. ok markus@.
|
ssh-keygen -l -v. ok markus@.
|
||||||
|
- jakob@cvs.openbsd.org 2001/03/11 15:13:09
|
||||||
|
[key.c]
|
||||||
|
cleanup & shorten some var names key_fingerprint_bubblebabble.
|
||||||
|
|
||||||
20010311
|
20010311
|
||||||
- OpenBSD CVS Sync
|
- OpenBSD CVS Sync
|
||||||
|
@ -4504,4 +4507,4 @@
|
||||||
- Wrote replacements for strlcpy and mkdtemp
|
- Wrote replacements for strlcpy and mkdtemp
|
||||||
- Released 1.0pre1
|
- Released 1.0pre1
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.942 2001/03/11 20:05:19 mouring Exp $
|
$Id: ChangeLog,v 1.943 2001/03/11 20:06:59 mouring Exp $
|
||||||
|
|
50
key.c
50
key.c
|
@ -32,7 +32,7 @@
|
||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: key.c,v 1.19 2001/03/11 15:03:15 jakob Exp $");
|
RCSID("$OpenBSD: key.c,v 1.20 2001/03/11 15:13:09 jakob Exp $");
|
||||||
|
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
|
|
||||||
|
@ -236,46 +236,44 @@ key_fingerprint_bubblebabble(u_char* dgst_raw, size_t dgst_raw_len)
|
||||||
char vowels[] = { 'a', 'e', 'i', 'o', 'u', 'y' };
|
char vowels[] = { 'a', 'e', 'i', 'o', 'u', 'y' };
|
||||||
char consonants[] = { 'b', 'c', 'd', 'f', 'g', 'h', 'k', 'l', 'm',
|
char consonants[] = { 'b', 'c', 'd', 'f', 'g', 'h', 'k', 'l', 'm',
|
||||||
'n', 'p', 'r', 's', 't', 'v', 'z', 'x' };
|
'n', 'p', 'r', 's', 't', 'v', 'z', 'x' };
|
||||||
u_int rounds, idx, retval_idx, seed;
|
u_int i, j = 0, rounds, seed = 1;
|
||||||
char *retval;
|
char *retval;
|
||||||
|
|
||||||
rounds = (dgst_raw_len / 2) + 1;
|
rounds = (dgst_raw_len / 2) + 1;
|
||||||
retval = xmalloc(sizeof(char) * (rounds*6));
|
retval = xmalloc(sizeof(char) * (rounds*6));
|
||||||
seed = 1;
|
retval[j++] = 'x';
|
||||||
retval_idx = 0;
|
for (i = 0; i < rounds; i++) {
|
||||||
retval[retval_idx++] = 'x';
|
|
||||||
for (idx=0;idx<rounds;idx++) {
|
|
||||||
u_int idx0, idx1, idx2, idx3, idx4;
|
u_int idx0, idx1, idx2, idx3, idx4;
|
||||||
if ((idx + 1 < rounds) || (dgst_raw_len % 2 != 0)) {
|
if ((i + 1 < rounds) || (dgst_raw_len % 2 != 0)) {
|
||||||
idx0 = (((((u_int)(dgst_raw[2 * idx])) >> 6) & 3) +
|
idx0 = (((((u_int)(dgst_raw[2 * i])) >> 6) & 3) +
|
||||||
seed) % 6;
|
seed) % 6;
|
||||||
idx1 = (((u_int)(dgst_raw[2 * idx])) >> 2) & 15;
|
idx1 = (((u_int)(dgst_raw[2 * i])) >> 2) & 15;
|
||||||
idx2 = ((((u_int)(dgst_raw[2 * idx])) & 3) +
|
idx2 = ((((u_int)(dgst_raw[2 * i])) & 3) +
|
||||||
(seed / 6)) % 6;
|
(seed / 6)) % 6;
|
||||||
retval[retval_idx++] = vowels[idx0];
|
retval[j++] = vowels[idx0];
|
||||||
retval[retval_idx++] = consonants[idx1];
|
retval[j++] = consonants[idx1];
|
||||||
retval[retval_idx++] = vowels[idx2];
|
retval[j++] = vowels[idx2];
|
||||||
if ((idx + 1) < rounds) {
|
if ((i + 1) < rounds) {
|
||||||
idx3 = (((u_int)(dgst_raw[(2 * idx) + 1])) >> 4) & 15;
|
idx3 = (((u_int)(dgst_raw[(2 * i) + 1])) >> 4) & 15;
|
||||||
idx4 = (((u_int)(dgst_raw[(2 * idx) + 1]))) & 15;
|
idx4 = (((u_int)(dgst_raw[(2 * i) + 1]))) & 15;
|
||||||
retval[retval_idx++] = consonants[idx3];
|
retval[j++] = consonants[idx3];
|
||||||
retval[retval_idx++] = '-';
|
retval[j++] = '-';
|
||||||
retval[retval_idx++] = consonants[idx4];
|
retval[j++] = consonants[idx4];
|
||||||
seed = ((seed * 5) +
|
seed = ((seed * 5) +
|
||||||
((((u_int)(dgst_raw[2 * idx])) * 7) +
|
((((u_int)(dgst_raw[2 * i])) * 7) +
|
||||||
((u_int)(dgst_raw[(2 * idx) + 1])))) % 36;
|
((u_int)(dgst_raw[(2 * i) + 1])))) % 36;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
idx0 = seed % 6;
|
idx0 = seed % 6;
|
||||||
idx1 = 16;
|
idx1 = 16;
|
||||||
idx2 = seed / 6;
|
idx2 = seed / 6;
|
||||||
retval[retval_idx++] = vowels[idx0];
|
retval[j++] = vowels[idx0];
|
||||||
retval[retval_idx++] = consonants[idx1];
|
retval[j++] = consonants[idx1];
|
||||||
retval[retval_idx++] = vowels[idx2];
|
retval[j++] = vowels[idx2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
retval[retval_idx++] = 'x';
|
retval[j++] = 'x';
|
||||||
retval[retval_idx++] = '\0';
|
retval[j++] = '\0';
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue