This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.swift | |
// NaceApp | |
// | |
// Created by Tobias Haeberle on 14.12.18. | |
// | |
import UIKit | |
class ViewController: UITableViewController { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Array where Element == UInt8 { | |
var md5Hash: [UInt8] { | |
var hash = [UInt8](repeating: 0, count: Int(CC_MD5_DIGEST_LENGTH)) | |
CC_MD5(self, UInt32(self.count), &hash) | |
return hash | |
} | |
var hexString : String { | |
return self.reduce(into: "", { $0 += String(format: "%02x", $1) }) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
private let ALLOWED_BYTES: [UInt8] = [ | |
// 0 1 2 3 4 5 | |
0b00110000, 0b00110001, 0b00110010, 0b00110011, 0b00110100, 0b00110101, | |
// 6 7 8 9 A B | |
0b00110110, 0b00110111, 0b00111000, 0b00111001, 0b01000001, 0b01000010, | |
// C D E D G H | |
0b01000011, 0b01000100, 0b01000101, 0b01000110, 0b01000111, 0b01001000, | |
// I J K L M N |