Differences From Artifact [78fa704049]:
- File
src/OFString+CryptoHashing.m
— part of check-in
[4af49a13c3]
at
2017-05-07 20:10:13
on branch trunk
— Small code style change
Casts are now written like types in variable declarations. (user: js, size: 2307) [annotate] [blame] [check-ins using]
To Artifact [68de61fc18]:
- File
src/OFString+CryptoHashing.m
— part of check-in
[6b77a5dd8b]
at
2017-05-21 21:28:57
on branch trunk
— Prefix private methods with of_ instead of OF_
This matches Apple's style. (user: js, size: 2307) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
25 26 27 28 29 30 31 | #import "OFSHA256Hash.h" #import "OFSHA384Hash.h" #import "OFSHA512Hash.h" int _OFString_CryptoHashing_reference; @implementation OFString (CryptoHashing) | | | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #import "OFSHA256Hash.h" #import "OFSHA384Hash.h" #import "OFSHA512Hash.h" int _OFString_CryptoHashing_reference; @implementation OFString (CryptoHashing) - (OFString *)of_cryptoHashWithClass: (Class <OFCryptoHash>)class { void *pool = objc_autoreleasePoolPush(); id <OFCryptoHash> hash = [class cryptoHash]; size_t digestSize = [class digestSize]; const unsigned char *digest; char cString[digestSize * 2]; |
︙ | ︙ | |||
56 57 58 59 60 61 62 | return [OFString stringWithCString: cString encoding: OF_STRING_ENCODING_ASCII length: digestSize * 2]; } - (OFString *)MD5Hash { | | | | | | | | | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | return [OFString stringWithCString: cString encoding: OF_STRING_ENCODING_ASCII length: digestSize * 2]; } - (OFString *)MD5Hash { return [self of_cryptoHashWithClass: [OFMD5Hash class]]; } - (OFString *)RIPEMD160Hash { return [self of_cryptoHashWithClass: [OFRIPEMD160Hash class]]; } - (OFString *)SHA1Hash { return [self of_cryptoHashWithClass: [OFSHA1Hash class]]; } - (OFString *)SHA224Hash { return [self of_cryptoHashWithClass: [OFSHA224Hash class]]; } - (OFString *)SHA256Hash { return [self of_cryptoHashWithClass: [OFSHA256Hash class]]; } - (OFString *)SHA384Hash { return [self of_cryptoHashWithClass: [OFSHA384Hash class]]; } - (OFString *)SHA512Hash { return [self of_cryptoHashWithClass: [OFSHA512Hash class]]; } @end |