initial commit
This commit is contained in:
commit
7be2b66bd2
14 changed files with 2206 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
img
|
||||||
7
README.md
Normal file
7
README.md
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
# Attempt to solve the BTC 310 Challenge
|
||||||
|
|
||||||
|
https://bitcoinchallenge.codes/
|
||||||
|
|
||||||
|
## Solution
|
||||||
|
|
||||||
|
https://docs.google.com/document/d/1nUAhlC_n21ZLZcRAHpLw9G--gpk4NUVIJqVp9F68qp4/preview
|
||||||
1
alpha.b64
Normal file
1
alpha.b64
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
U2FsdGVkX19Q3I//VCH0U3cVtITZ3ckILJnUcdPX3Gs5qjdF1UjZ3mAftGivtFYDN5ZCSkBynnVqBawl4p8wKO0O8zI6D0A1+VEVCUyEvEeNoUfGcS0El9d93vsPxbg7D5avufQsScgsk3QEtq9/M4Do32OKFeq00/3NrxWOsMmh3AXmDzuuZ0qmZaI7re16FcXIrmPPiQDOHRc7wt0ng6qLiNz7VqESRTdxPOahKFRkWT8sT+Ur2y+2iZ2LEaxNM7UZqcPwYgm6FoKOVjnqdeg30R27jc6AoFPyRZ2g8+EJMp3n/pf94oSCLEWkc0osjH9DqbM6DUptu3HJbAVwXQ==
|
||||||
BIN
alpha.png
Normal file
BIN
alpha.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
7
btc1.py
Executable file
7
btc1.py
Executable file
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
key = "20181002"
|
||||||
|
encrypted = "511B2033232841053022B0FE52ED0F7A165B52C7E75112F656FC4B"
|
||||||
|
for i in range(len(encrypted)):
|
||||||
|
print(hex((int(encrypted[i],16)-int(key[i%len(key)])) % 16))
|
||||||
|
if i %18 == 0:
|
||||||
|
print("\n")
|
||||||
12
btc1.txt
Normal file
12
btc1.txt
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
20181002
|
||||||
|
|
||||||
|
310 310 310 310 310
|
||||||
|
|
||||||
|
1AA 0FC 32D 544 78F 643
|
||||||
|
42C 5C7 490 2F4 36E 43B
|
||||||
|
|
||||||
|
|
||||||
|
1AA0FC32D54478F643
|
||||||
|
42C5C74902F436E43B
|
||||||
|
|
||||||
|
1AA0FC32D54478F64342C5C74902F436E43B
|
||||||
14
dec
Executable file
14
dec
Executable file
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
DIR="/tmp/btc310"
|
||||||
|
[ ! -d $DIR ] && mkdir -p $DIR
|
||||||
|
PASSWD="$1";
|
||||||
|
FILE="$2";
|
||||||
|
for i in $(openssl enc -ciphers 2>&1 | tail -n +2 | xargs | sed 's/ -/ /g' | sed 's/^.//'); do
|
||||||
|
openssl enc -d -$i -md md5 -a -k "$PASSWD" -in "$FILE" -out $DIR/$i.dec 2> /dev/null
|
||||||
|
if [ $? -ne 0 -o ! -s $DIR/$i.dec ]; then
|
||||||
|
rm $DIR/$i.dec
|
||||||
|
else
|
||||||
|
strings $DIR/$i.dec | grep Bitcoin >/dev/null && { echo $DIR/$i.dec; cat $DIR/$i.dec; }
|
||||||
|
fi
|
||||||
|
done
|
||||||
2048
english.txt
Normal file
2048
english.txt
Normal file
File diff suppressed because it is too large
Load diff
1
go.mod
Normal file
1
go.mod
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
module main
|
||||||
112
img.go
Normal file
112
img.go
Normal file
|
|
@ -0,0 +1,112 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"image"
|
||||||
|
"image/color"
|
||||||
|
"image/png"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"strconv"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func red(p image.Image) image.Image {
|
||||||
|
bits := ""
|
||||||
|
rect := p.Bounds()
|
||||||
|
n := image.NewRGBA(rect)
|
||||||
|
for i := 0; i < rect.Max.Y; i++ {
|
||||||
|
for j := 0; j < rect.Max.X; j++ {
|
||||||
|
r, g, _, _ := p.At(j, i).RGBA()
|
||||||
|
if i == 310 {
|
||||||
|
//c, _, _, _ := p.(*image.NRGBA).At(j, i).RGBA()
|
||||||
|
//c := color.RGBAModel.Convert(p.At(j, i)).(color.RGBA).R
|
||||||
|
fmt.Fprintf(os.Stderr, "%08b %08b\n", uint8(r), uint8(g))
|
||||||
|
fmt.Fprintf(os.Stderr, "%d %d\n", uint8(r), uint8(g))
|
||||||
|
//bin := strconv.FormatUint(uint64(c.Y), 2)
|
||||||
|
bin := fmt.Sprintf("%08b", uint8(g))
|
||||||
|
bits += string(bin[len(bin)-1])
|
||||||
|
prntln(" 10110101010001\n", bits)
|
||||||
|
time.Sleep(time.Second)
|
||||||
|
}
|
||||||
|
if r != g {
|
||||||
|
n.Set(j, i, color.Black)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
n.Set(j, i, color.White)
|
||||||
|
// y 1648
|
||||||
|
// x 1538
|
||||||
|
}
|
||||||
|
}
|
||||||
|
prntln(bits)
|
||||||
|
b := bit2bytes(bits)
|
||||||
|
_, a := alpha(p)
|
||||||
|
for i := 0; i < len(a); i++ {
|
||||||
|
a[i] ^= b[i]
|
||||||
|
}
|
||||||
|
bits = ""
|
||||||
|
for _, v := range a {
|
||||||
|
bits += fmt.Sprintf("%08b", ^v)
|
||||||
|
}
|
||||||
|
//prntln(bits)
|
||||||
|
prntln(string(bit2bytes(bits)))
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
func alpha(p image.Image) (image.Image, []byte) {
|
||||||
|
bits := ""
|
||||||
|
rect := p.Bounds()
|
||||||
|
n := image.NewRGBA(rect)
|
||||||
|
for i := 0; i < rect.Max.Y; i++ {
|
||||||
|
for j := 0; j < rect.Max.X; j++ {
|
||||||
|
_, _, _, a := p.At(j, i).RGBA()
|
||||||
|
if a == 65021 {
|
||||||
|
n.Set(j, i, color.White)
|
||||||
|
if i == 310 {
|
||||||
|
bits += "1"
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if a == 65278 {
|
||||||
|
n.Set(j, i, color.Black)
|
||||||
|
if i == 310 {
|
||||||
|
bits += "0"
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
n.Set(j, i, color.White)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return n, bit2bytes(bits)
|
||||||
|
}
|
||||||
|
|
||||||
|
func prntln(v ...interface{}) {
|
||||||
|
fmt.Fprintln(os.Stderr, v...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func bit2bytes(s string) (b []byte) {
|
||||||
|
for i := 0; i < len(s)-8; i += 8 {
|
||||||
|
n, _ := strconv.ParseUint(s[i:i+8], 2, 8)
|
||||||
|
b = append(b, byte(n))
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
f, err := os.Open("challenge.png")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
p, err := png.Decode(f)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
n := red(p)
|
||||||
|
//n, bits := alpha(p)
|
||||||
|
//prntln(string(bits))
|
||||||
|
|
||||||
|
err = png.Encode(os.Stdout, n)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
2
pwd
Normal file
2
pwd
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
L379F48502 - alpha.b64
|
||||||
|
02L3F95847 - red.b64
|
||||||
1
red.b64
Normal file
1
red.b64
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
U2FsdGVkX1+WPMJQISUVUvGRg7p4zCX4jIODIGb6b6cAreXFxv0WOxgCeSw9K+imTHiWMkRq45FsPXHs3TjYqcJz7QzQ8HeM340EwWQWXAi0fVy+r6NPmiJRgMgMqLCu4Q9o/WkNyHxvPScNgG9jf8gskggx10FiTcoyF1KE+nxjmRkEuj7uQQsPrrlRP3sjll4KXhAzrGQZi5E4sajQOBGQfaJjei5fHXXO6sxeYsFcuxzo3JdMOF3JFYQtuUDY
|
||||||
BIN
red.png
Normal file
BIN
red.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
BIN
solution.pdf
Normal file
BIN
solution.pdf
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue