Differences From Artifact [85e48149ff]:
- File
NewPasswordGenerator.m
— part of check-in
[007bd9985e]
at
2021-03-21 11:03:01
on branch trunk
— Allow swappable memory
Most OSes and/or ulimits do not allow allocating such large amounts of
unswappable memory. (user: js, size: 3246) [annotate] [blame] [check-ins using]
To Artifact [b6004b9716]:
- File NewPasswordGenerator.m — part of check-in [aec6746a96] at 2021-04-28 21:51:03 on branch trunk — Adjust to ObjFW changes (user: js, size: 3235) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
39 40 41 42 43 44 45 | return self; } - (void)derivePassword { OFSHA384Hash *siteHash = [OFSHA384Hash | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | return self; } - (void)derivePassword { OFSHA384Hash *siteHash = [OFSHA384Hash hashWithAllowsSwappableMemory: true]; size_t passphraseLength, combinedPassphraseLength; OFSecureData *combinedPassphrase; char *combinedPassphraseItems; unsigned char *outputItems; [siteHash updateWithBuffer: _site.UTF8String length: _site.UTF8StringLength]; |
︙ | ︙ | |||
72 73 74 75 76 77 78 | memcpy(combinedPassphraseItems, _passphrase.items, passphraseLength); if (_keyFile != nil) memcpy(combinedPassphraseItems + passphraseLength, _keyFile.items, _keyFile.count); outputItems = _output.mutableItems; | | | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | memcpy(combinedPassphraseItems, _passphrase.items, passphraseLength); if (_keyFile != nil) memcpy(combinedPassphraseItems + passphraseLength, _keyFile.items, _keyFile.count); outputItems = _output.mutableItems; OFScrypt((OFScryptParameters){ .blockSize = 8, .costFactor = 524288, .parallelization = 2, .salt = siteHash.digest, .saltLength = [siteHash.class digestSize], .password = combinedPassphraseItems, .passwordLength = combinedPassphraseLength, |
︙ | ︙ |