- jakob@cvs.openbsd.org 2001/03/11 15:13:09
[key.c]
cleanup & shorten some var names key_fingerprint_bubblebabble.
diff --git a/key.c b/key.c
index d8f994b..17a6c78 100644
--- a/key.c
+++ b/key.c
@@ -32,7 +32,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#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>
@@ -236,46 +236,44 @@
char vowels[] = { 'a', 'e', 'i', 'o', 'u', 'y' };
char consonants[] = { 'b', 'c', 'd', 'f', 'g', 'h', 'k', 'l', 'm',
'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;
rounds = (dgst_raw_len / 2) + 1;
retval = xmalloc(sizeof(char) * (rounds*6));
- seed = 1;
- retval_idx = 0;
- retval[retval_idx++] = 'x';
- for (idx=0;idx<rounds;idx++) {
+ retval[j++] = 'x';
+ for (i = 0; i < rounds; i++) {
u_int idx0, idx1, idx2, idx3, idx4;
- if ((idx + 1 < rounds) || (dgst_raw_len % 2 != 0)) {
- idx0 = (((((u_int)(dgst_raw[2 * idx])) >> 6) & 3) +
+ if ((i + 1 < rounds) || (dgst_raw_len % 2 != 0)) {
+ idx0 = (((((u_int)(dgst_raw[2 * i])) >> 6) & 3) +
seed) % 6;
- idx1 = (((u_int)(dgst_raw[2 * idx])) >> 2) & 15;
- idx2 = ((((u_int)(dgst_raw[2 * idx])) & 3) +
+ idx1 = (((u_int)(dgst_raw[2 * i])) >> 2) & 15;
+ idx2 = ((((u_int)(dgst_raw[2 * i])) & 3) +
(seed / 6)) % 6;
- retval[retval_idx++] = vowels[idx0];
- retval[retval_idx++] = consonants[idx1];
- retval[retval_idx++] = vowels[idx2];
- if ((idx + 1) < rounds) {
- idx3 = (((u_int)(dgst_raw[(2 * idx) + 1])) >> 4) & 15;
- idx4 = (((u_int)(dgst_raw[(2 * idx) + 1]))) & 15;
- retval[retval_idx++] = consonants[idx3];
- retval[retval_idx++] = '-';
- retval[retval_idx++] = consonants[idx4];
+ retval[j++] = vowels[idx0];
+ retval[j++] = consonants[idx1];
+ retval[j++] = vowels[idx2];
+ if ((i + 1) < rounds) {
+ idx3 = (((u_int)(dgst_raw[(2 * i) + 1])) >> 4) & 15;
+ idx4 = (((u_int)(dgst_raw[(2 * i) + 1]))) & 15;
+ retval[j++] = consonants[idx3];
+ retval[j++] = '-';
+ retval[j++] = consonants[idx4];
seed = ((seed * 5) +
- ((((u_int)(dgst_raw[2 * idx])) * 7) +
- ((u_int)(dgst_raw[(2 * idx) + 1])))) % 36;
+ ((((u_int)(dgst_raw[2 * i])) * 7) +
+ ((u_int)(dgst_raw[(2 * i) + 1])))) % 36;
}
} else {
idx0 = seed % 6;
idx1 = 16;
idx2 = seed / 6;
- retval[retval_idx++] = vowels[idx0];
- retval[retval_idx++] = consonants[idx1];
- retval[retval_idx++] = vowels[idx2];
+ retval[j++] = vowels[idx0];
+ retval[j++] = consonants[idx1];
+ retval[j++] = vowels[idx2];
}
}
- retval[retval_idx++] = 'x';
- retval[retval_idx++] = '\0';
+ retval[j++] = 'x';
+ retval[j++] = '\0';
return retval;
}