Created
April 19, 2015 10:37
-
-
Save DanielMorsing/c7fc6d75929ff060b103 to your computer and use it in GitHub Desktop.
A shitty thing I did in order to pgp sign a tweet.
This file contains 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
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"math/big" | |
"os" | |
) | |
func main() { | |
b, _ := ioutil.ReadAll(os.Stdin) | |
i := 0 | |
j := len(b)-1 | |
for j >= i { | |
b[i], b[j] = b[j], b[i] | |
i++ | |
j-- | |
} | |
var bi big.Int | |
bi.SetBytes(b) | |
blen := uint(bi.BitLen()) | |
var x uint | |
xi := make([]rune, 0) | |
for i := uint(0); i < blen; i++ { | |
x = bi.Bit(int(i)) | (x << 1) | |
if (i%14) == 0 && i != 0 { | |
xi = append(xi, 0x20000+rune(x)) | |
x = 0 | |
} | |
} | |
if x != 0 { | |
xi = append(xi, 0x20000+rune(x)) | |
} | |
fmt.Println(string(xi)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment