|
|
@@ -9,23 +9,22 @@ Good mood
|
|
|
- Easy to use
|
|
|
- Convenience extensions
|
|
|
|
|
|
-####what implemented?
|
|
|
+###What implemented?
|
|
|
|
|
|
#### Hash
|
|
|
-- MD5
|
|
|
-- SHA1
|
|
|
-- SHA224
|
|
|
-- SHA256
|
|
|
-- SHA384
|
|
|
-- SHA512
|
|
|
-- CRC32 (well, kind of hash)
|
|
|
+- [MD5](http://tools.ietf.org/html/rfc1321)
|
|
|
+- [SHA1](http://tools.ietf.org/html/rfc3174)
|
|
|
+- [SHA224](http://tools.ietf.org/html/rfc6234)
|
|
|
+- [SHA256](http://tools.ietf.org/html/rfc6234)
|
|
|
+- [SHA384](http://tools.ietf.org/html/rfc6234)
|
|
|
+- [SHA512](http://tools.ietf.org/html/rfc6234)
|
|
|
+- [CRC32](http://en.wikipedia.org/wiki/Cyclic_redundancy_check) (well, kind of hash)
|
|
|
|
|
|
#####Cipher
|
|
|
-- ChaCha20
|
|
|
+- [ChaCha20](http://cr.yp.to/chacha/chacha-20080128.pdf)
|
|
|
|
|
|
-####[Why?](https://github.com/krzyzanowskim/CryptoSwift/issues/5)
|
|
|
-
|
|
|
-[Because I can](https://github.com/krzyzanowskim/CryptoSwift/issues/5#issuecomment-53379391)
|
|
|
+###Why
|
|
|
+[Why?](https://github.com/krzyzanowskim/CryptoSwift/issues/5) [Because I can](https://github.com/krzyzanowskim/CryptoSwift/issues/5#issuecomment-53379391).
|
|
|
|
|
|
##Usage
|
|
|
|
|
|
@@ -60,6 +59,22 @@ Hashing a String and printing result
|
|
|
println(hash)
|
|
|
}
|
|
|
|
|
|
+Working with Cipher
|
|
|
+
|
|
|
+ // convenience setup tuplet
|
|
|
+ let setup = (key: keyData, iv: ivData)
|
|
|
+
|
|
|
+ // encrypt
|
|
|
+ let encrypted:NSData = Cipher.ChaCha20(setup).encrypt(dataToEncrypt)
|
|
|
+
|
|
|
+ // decrypt
|
|
|
+ let decrypted:NSData = Cipher.ChaCha20(setup).decrypt(encrypted)
|
|
|
+
|
|
|
+ // check
|
|
|
+ if (encrypted.isEqual(decrypted)) {
|
|
|
+ print("Decryption failed!")
|
|
|
+ }
|
|
|
+
|
|
|
##Contact
|
|
|
Marcin Krzyżanowski [@krzyzanowskim](http://twitter.com/krzyzanowskim)
|
|
|
|