Matasano Crypto Challenges - Set 1 - Challenge 1 - Solved in Go

written in cryptopals, go, matasano, programming

This is the solution I came up with in Go for Set 1 / Challenge 1 of the matasano crypto challenges.

Code after the break…

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package main

import b64 "encoding/base64"
import hex "encoding/hex"
import "fmt"

func main() {
    data := "49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f" +
            "69736f6e6f7573206d757368726f6f6d"

    hexData, _ := hex.DecodeString(data)
    hexEnc := b64.StdEncoding.EncodeToString(hexData)

    fmt.Println(hexEnc)
}

Running this will output the expected result, like so:

1
2
Pu:~ nate$ go run test.go
SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t

Comments