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
| // Code to send push notifications. Most of the code is taken from https://github.com/sideshow/apns2/ | |
| // I wrote this because I didn't want to use any 3rd party dependencies. | |
| package main | |
| import ( | |
| "bytes" | |
| "context" | |
| "crypto/ecdsa" | |
| "crypto/rand" |
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
| // The following code has been tested. It compiles and works. | |
| // Swift code | |
| func encrypt(input: [UInt8]) -> Data? { | |
| let key = SymmetricKey(size: .bits256) | |
| let key64 = key.withUnsafeBytes { | |
| return Data(Array($0)).base64EncodedString() | |
| } | |
| print("key64:", key64) | |
| var sealedBox: AES.GCM.SealedBox |
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
| """ | |
| Computes the probability distribution of states created by | |
| the shuffle2 algorithm. This should return results similar to | |
| enumerate_shuffle.py. | |
| A state is a 2-tuple: (swapped, deck) | |
| The probability of transitioning from one state to another can be represented by | |
| a Markov matrix M. |
NewerOlder