Skip to content

A Swift library that provides cryptographic authentication algorithms like OCRA, HOTP etc.

License

Notifications You must be signed in to change notification settings

pinarol/AuthentiCode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Intro

A Swift library that provides cryptographic authentication algorithms.

Setup

Available via SPM. Check out Package.swift.

Usage

HOTP:

import AuthentiCode

let counter: UInt64 = // pass a counter value
let secret = "12345678901234567890".data(using: .utf8)!
let hotp = HOTP.generate(secret: secret, counter: UInt64(1))
print("HOTP: \(hotp)")

OCRA:

import AuthentiCode

let ocraSuite = "OCRA-1:HOTP-SHA256-8:QN08-PSHA1"
let key = "3132333435363738393031323334353637383930313233343536373839303132"
let password = "7110eda4d09e062aa5e4a390b0a572ac0d2c0220" // 1234 SHA1 hash value.
let sessionInformation = ""
let counter = ""
let timeStamp = ""
let question = "hello".hexString! // hex representation of a question. 
let ocra = OCRA.generate(ocraSuite: ocraSuite, key: key, counter: counter, question: question, password: password, sessionInformation: sessionInformation, timeStamp: timeStamp)
print("OCRA: \(ocra)")

Check out unit tests for further examples.

About

A Swift library that provides cryptographic authentication algorithms like OCRA, HOTP etc.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages