Skip to content

Commit 9432c71

Browse files
committed
Merge for GitHub PR #63.
Also some doc improvements. Bumped CocoaPods version to 0.9.2.
1 parent 008034e commit 9432c71

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+15681
-1564
lines changed

IDZSwiftCommonCrypto.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22

33
s.name = "IDZSwiftCommonCrypto"
4-
s.version = "0.9.1"
4+
s.version = "0.9.2"
55
s.summary = "A wrapper for Apple's Common Crypto library written in Swift."
66

77
s.homepage = "https://github.com/iosdevzone/IDZSwiftCommonCrypto"

README.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -64,42 +64,42 @@ or
6464
### Supported Algorithms
6565
The `Digest` class supports the following algorithms:
6666

67-
* `.MD2`
68-
* `.MD4`
69-
* `.MD5`
70-
* `.SHA1`
71-
* `.SHA224`
72-
* `.SHA256`
73-
* `.SHA384`
74-
* `.SHA512`
67+
* `.md2`
68+
* `.md4`
69+
* `.md5`
70+
* `.sha1`
71+
* `.sha224`
72+
* `.sha256`
73+
* `.sha384`
74+
* `.sha512`
7575

7676
Using `HMAC`
7777
------------
7878

7979
Calculating a keyed-Hash Message Authentication Code (HMAC) is very similar to calculating a message digest, except that the initialization routine now takes a key as well as an algorithm parameter.
8080

8181
```swift
82-
var keys5 = arrayFromHexString("0102030405060708090a0b0c0d0e0f10111213141516171819")
82+
var keys5 = arrayFrom(hexString: "0102030405060708090a0b0c0d0e0f10111213141516171819")
8383
var datas5 : [UInt8] = Array(count:50, repeatedValue:0xcd)
84-
var expecteds5 = arrayFromHexString("4c9007f4026250c6bc8414f9bf50c86c2d7235da")
85-
var hmacs5 = HMAC(algorithm:.SHA1, key:keys5).update(datas5)?.final()
84+
var expecteds5 = arrayFrom(hexString: "4c9007f4026250c6bc8414f9bf50c86c2d7235da")
85+
var hmacs5 = HMAC(algorithm:.sha1, key:keys5).update(datas5)?.final()
8686

8787
// RFC2202 says this should be 4c9007f4026250c6bc8414f9bf50c86c2d7235da
88-
let expectedRFC2202 = arrayFromHexString("4c9007f4026250c6bc8414f9bf50c86c2d7235da")
88+
let expectedRFC2202 = arrayFrom(hexString: "4c9007f4026250c6bc8414f9bf50c86c2d7235da")
8989
assert(hmacs5! == expectedRFC2202)
9090
```
9191
### Supported Algorithms
92-
* SHA1
93-
* MD5
94-
* SHA224
95-
* SHA256
96-
* SHA384
97-
* SHA512
92+
* `.md5`
93+
* `.sha1`
94+
* `.sha224`
95+
* `.sha256`
96+
* `.sha384`
97+
* `.sha512`
9898

9999
## Using `Cryptor`
100100

101101
```swift
102-
var key = arrayFromHexString("2b7e151628aed2a6abf7158809cf4f3c")
102+
var key = arrayFrom(hexString: "2b7e151628aed2a6abf7158809cf4f3c")
103103
var plainText = "The quick brown fox jumps over the lazy dog. The fox has more or less had it at this point."
104104

105105
var cryptor = Cryptor(operation:.encrypt, algorithm:.aes, options:.PKCS7Padding, key:key, iv:Array<UInt8>())
@@ -187,14 +187,14 @@ The following example derives a 20-byte key:
187187
```swift
188188
let keys6 = PBKDF.deriveKey("password", salt: "salt", prf: .SHA1, rounds: 1, derivedKeyLength: 20)
189189
// RFC 6070 - Should derive 0c60c80f961f0e71f3a9b524af6012062fe037a6
190-
let expectedRFC6070 = arrayFromHexString("0c60c80f961f0e71f3a9b524af6012062fe037a6")
190+
let expectedRFC6070 = arrayFrom(hexString: "0c60c80f961f0e71f3a9b524af6012062fe037a6")
191191
assert(keys6 == expectedRFC6070)
192192
```
193193
### Supported Pseudo-Random Functions
194-
* `.SHA1`
195-
* `.SHA224`
196-
* `.SHA256`
197-
* `.SHA384`
198-
* `.SHA512`
194+
* `.sha1`
195+
* `.sha224`
196+
* `.sha256`
197+
* `.sha384`
198+
* `.sha512`
199199

200200

0 commit comments

Comments
 (0)