Skip to content

Instantly share code, notes, and snippets.

View 1f604's full-sized avatar

// MD_Update(&m,buf,j); 1f604

View GitHub Profile
@1f604
1f604 / golang token based apns push notification.go
Last active June 18, 2021 23:13
golang push notification apple apns http2 token-based
// 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"
@1f604
1f604 / swift to golang aes gcm encryption
Last active June 16, 2021 21:25
Swift to golang AES-GCM encryption decryption working example code
// 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
@1f604
1f604 / matrix_shuffle.py
Created December 20, 2018 17:46 — forked from anonymous/matrix_shuffle.py
matrix_shuffle.py
"""
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.