SPB Git

spb/os-vault Public

Self-custody, multi-chain crypto wallet for macOS. One recovery phrase, six chain families, zero API keys — nothing leaves your Mac.

Swift 96% Shell 3.4% Makefile 0.6%
536 B · 23 lines swift
Raw Blame History
1import Foundation23public extension Array where Element == UInt8 {4    func toUInt32() -> UInt32? {5        let data = Data(self)6        return UInt32(littleEndian: data.withUnsafeBytes { $0.pointee })7    }89    func toUInt64() -> UInt64? {10        let data = Data(self)11        return UInt64(littleEndian: data.withUnsafeBytes { $0.pointee })12    }1314    func toInt() -> Int {15        var value = 016        for byte in self {17            value = value << 818            value = value | Int(byte)19        }20        return value21    }22}23