MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / BF_encode

Function BF_encode

system/lib/libc/musl/src/crypt/crypt_blowfish.c:398–428  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

396}
397
398static void BF_encode(char *dst, const BF_word *src, int size)
399{
400 const unsigned char *sptr = (const unsigned char *)src;
401 const unsigned char *end = sptr + size;
402 unsigned char *dptr = (unsigned char *)dst;
403 unsigned int c1, c2;
404
405 do {
406 c1 = *sptr++;
407 *dptr++ = BF_itoa64[c1 >> 2];
408 c1 = (c1 & 0x03) << 4;
409 if (sptr >= end) {
410 *dptr++ = BF_itoa64[c1];
411 break;
412 }
413
414 c2 = *sptr++;
415 c1 |= c2 >> 4;
416 *dptr++ = BF_itoa64[c1];
417 c1 = (c2 & 0x0f) << 2;
418 if (sptr >= end) {
419 *dptr++ = BF_itoa64[c1];
420 break;
421 }
422
423 c2 = *sptr++;
424 c1 |= c2 >> 6;
425 *dptr++ = BF_itoa64[c1];
426 *dptr++ = BF_itoa64[c2 & 0x3f];
427 } while (sptr < end);
428}
429
430static void BF_swap(BF_word *x, int count)
431{

Callers 1

BF_cryptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected