0001 #if os(Linux) 0002 import Glibc 0003 #endif 0004 0005 import Foundation 0006 0007 0008 public class Hash{ 0009 0010 /** 0011 * The `applicationKey` adds an additional layer 0012 * of security to all hashes. 0013 * 0014 * Ensure this key stays 0015 * the same during the lifetime of your application, since 0016 * changing it will result in mismatching hashes. 0017 */ 0018 public static var applicationKey
Hash.swift:35 return Hash.driver.hash(string, key: applicationKey)Session.swift:64 key = Hash.make(key): String = "" 0019 0020 /** 0021 * Any class that conforms to the `HashDriver` 0022 * protocol may be set as the `Hash`'s driver. 0023 * It will be used to create the hashes 0024 * request by functions like `make()` 0025 */ 0026 public static var driver
Hash.swift:35 return Hash.driver.hash(string, key: applicationKey): HashDriver = SHA256Hasher() 0027 0028 /** 0029 * Hashes a string using the `Hash` class's 0030 * current `HashDriver` and `applicationString` salt. 0031 * 0032 * - returns: Hashed string 0033 */ 0034 public class func make
Hash.swift:35 return Hash.driver.hash(string, key: applicationKey)(string: String) -> String { 0035 return Hash.driver.hash(string, key: applicationKey) 0036 } 0037 0038 } 0039 0040 /** 0041 * Classes that conform to `HashDriver` may be set 0042 * as the `Hash` classes hashing engine. 0043 */ 0044 public protocol HashDriver
Session.swift:64 key = Hash.make(key){ 0045 0046 /** 0047 * Given a string, this function will 0048 * return the hashed string according 0049 * to whatever algorithm it chooses to implement. 0050 */ 0051 func hash
Hash.swift:26 public static var driver: HashDriver = SHA256Hasher()SHA256Hasher.swift:11 public class SHA256Hasher: HashDriver {(message: String, key: String) -> String 0052 } 0053 0054
Hash.swift:35 return Hash.driver.hash(string, key: applicationKey)