Created
February 7, 2016 05:48
-
-
Save jpillora/81e7b721418ed8a3fe04 to your computer and use it in GitHub Desktop.
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
package main | |
import ( | |
"encoding/binary" | |
"log" | |
"strconv" | |
) | |
func main() { | |
msg := "01011100000010101000000010011010000000100110100000001001101000000010011000101111100000001001100010111000101111001011111000000010011010000000100110100000001001100010111000101110001000001000000010011001011100010111001000000010011000101110010111000000101010000000100110100000001001101000000010011000101110001011100010111110000000100110001011100010111100101111100000001001101000000010011010000000100110100000001001100010000010000000100110001011100101110001011100100000001001100010111001011100000010101000000010011000101110001011100010111110110100101011110010111110000000100110001011100010111110110100101011110101110010000000100110100000001001101000000010011000101110001011100010111110101111001000000110000001011100100000001001100010111001011100101011110110000001011100000010100010111000101110001011110010111000101111100000001001100010111110000000100110001011100010111110000000100110001011100010111100101110011111000101111110000000100110100000001001100101111101111100001000000010111001011100100000001001100010111001011100100000001001100010111001011100100000001001100101110000101110010111000010111000101110000010100010100000101110001010001000000010011000101110001010001000000010011000101110001010001000000010011000101110001011110010111000101001001011100010111000101001001011100010111000101000001011100010111000101000001011100010000001011100100000001001100010111000101001100000001001100010111000101001100000001001100010111000101001001011100010100100001010001011100101110010000000100110100000001001101000000010011010000000100110100000001001100010111001011100001011111000000010011000101111100000001001100010111001011100001011100010000000101110001011100101110000101111100000001001101000000010011010000000100110100000001001101000000010011000101110001011110000101000101110001011100101110010000000100110100000001001101000000010011010000000100110100000001001100010111000101110001000000010111110000000100110100000001001100010111000101110010111001000000010011010000000100110100000001001101000000010011010000000100110001011100010111010000000100110001011110000101010000000100110001011100101110010000000100110100000001001101000000010011010000000100110001011100010111000101000100000001001101000000010011010000000100110001011100010000000101110001011100010100110000000100110100000001001101000000010011010000000100110100000001001100010111000101110000" | |
for i := 0; i < 4; i++ { | |
check(msg, i) | |
} | |
} | |
func check(msg string, offset int) { | |
for i := 0; i < offset; i++ { | |
msg = "0" + msg | |
} | |
bytes := []byte{} | |
for len(msg) > 0 { | |
l := len(msg) | |
if l > 64 { | |
l = 64 | |
} | |
m := msg[:l] | |
i, _ := strconv.ParseUint(m, 2, 64) | |
b := make([]byte, 8) | |
binary.BigEndian.PutUint64(b, i) | |
bytes = append(bytes, b...) | |
msg = msg[l:] | |
} | |
log.Printf("=========\n\n\n\n%d\n\n\n", offset) | |
log.Print(string(bytes)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment