Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

swift hmac256

import CryptoKit

let secretString = "my-secret"
let key = SymmetricKey(data: secretString.data(using: .utf8)!)

let string = "An apple a day keeps anyone away, if you throw it hard enough"

let signature = HMAC<SHA256>.authenticationCode(for: string.data(using: .utf8)!, using: key)
print(Data(signature).map { String(format: "%02hhx", $0) }.joined()) // 1c161b971ab68e7acdb0b45cca7ae92d574613b77fca4bc7d5c4effab89dab67
Comment

PREVIOUS NEXT
Code Example
Swift :: swift string interpolation 
Swift :: on edit input field provide default value if textfield get empty swift 
Swift :: UISearchController keys 
Swift :: swift get error from the from completion 
Swift :: func collectionview 
Swift :: star score rating swiftui 
Swift :: Abstract classes in Swift 
Swift :: code that detect input swift 
Swift :: swift constraints 
Swift :: let values = [3.0,6.0,9.0,1.0] let squares = values.map {$0 * $0} print(squares) 
Swift :: ns transport swift code 
Swift :: convert dictionary to data 
Swift :: Swift Add Elements to a Set 
Swift :: image preprocessing in python 
Swift :: Swift continue Statement With for Loop 
Swift :: string to decimal swift 
Swift :: allowed filename characters swift 
Ruby :: rails api only with postgress and rspec 
Ruby :: ruby refinement import dynamic methods 
Ruby :: ruby constructor 
Ruby :: rspec add support folder 
Ruby :: max keys from hash ruby 
Ruby :: merge two lists together ruby 
Ruby :: conditional operator in ruby 
Ruby :: convert string to date ruby 
Ruby :: ruby is character 
Ruby :: ruby on rails validates presence of multiple fields 
Ruby :: rails params require check exists 
Ruby :: how to destroy a generate in rails 
Ruby :: ruby lambda function 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =