380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
|
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
|
+
-
+
+
-
+
-
-
-
+
|
{
uint8_t buf[64];
size_t i;
assert(RAND_pseudo_bytes(buf, 64) >= 0);
for (i = 0; i < 64; i++) {
// Restrict salt to printable range, but do not include '~'...
uint8_t tmp = (buf[i] % ('~' - '!')) + '!';
buf[i] = (buf[i] % ('~' - '!')) + '!';
// ...so we can use it to replace ','
while (tmp == ',')
if (buf[i] == ',')
tmp = ((buf[i] >> 1) % ('~' - '!')) + '!';
buf[i] = tmp;
buf[i] = '~';
}
return [OFString stringWithCString: (char*)buf
encoding: OF_STRING_ENCODING_ASCII
length: 64];
}
|