diff options
author | Denis Vlasenko | 2008-12-07 01:16:34 +0000 |
---|---|---|
committer | Denis Vlasenko | 2008-12-07 01:16:34 +0000 |
commit | d1a84a2880073f6cc5e2f9f4e5f236cd110f01a0 (patch) | |
tree | 8e5b81c863ef3b91870812e822fecc3d97b0aff7 /libbb/pw_encrypt_des.c | |
parent | db12d1d733ab7de0c5f4cda261eb79fd334a4ed9 (diff) | |
download | busybox-d1a84a2880073f6cc5e2f9f4e5f236cd110f01a0.zip busybox-d1a84a2880073f6cc5e2f9f4e5f236cd110f01a0.tar.gz |
libbb: move crypt_make_salt() to pw_encrypt.c, reuse
bin-to-ascii64 conversion which does not require an array.
function old new delta
to64 29 33 +4
to64_msb_first 63 62 -1
ascii64 65 - -65
Diffstat (limited to 'libbb/pw_encrypt_des.c')
-rw-r--r-- | libbb/pw_encrypt_des.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libbb/pw_encrypt_des.c b/libbb/pw_encrypt_des.c index 4e506f4..52548d6 100644 --- a/libbb/pw_encrypt_des.c +++ b/libbb/pw_encrypt_des.c @@ -699,10 +699,16 @@ do_des(struct des_ctx *ctx, /*uint32_t l_in, uint32_t r_in,*/ uint32_t *l_out, u static void to64_msb_first(char *s, unsigned v) { +#if 0 *s++ = ascii64[(v >> 18) & 0x3f]; /* bits 23..18 */ *s++ = ascii64[(v >> 12) & 0x3f]; /* bits 17..12 */ *s++ = ascii64[(v >> 6) & 0x3f]; /* bits 11..6 */ - *s = ascii64[v & 0x3f]; /* bits 5..0 */ + *s = ascii64[v & 0x3f]; /* bits 5..0 */ +#endif + *s++ = i64c(v >> 18); /* bits 23..18 */ + *s++ = i64c(v >> 12); /* bits 17..12 */ + *s++ = i64c(v >> 6); /* bits 11..6 */ + *s = i64c(v); /* bits 5..0 */ } static char * |