title: Golang AES ECB Encryption
body: <p>Trying to emulate an algorithm in Go that is basically AES ECB Mode encryption.</p>
  
  <p>Here's what I have so far</p>
  
  <pre><code>func Decrypt(data []byte) []byte {
      cipher, err := aes.NewCipher([]byte(KEY))
      if err == nil {
          cipher.Decrypt(data, PKCS5Pad(data))
          return data
      }
      return nil
  }
  </code></pre>
  
  <p>I also have a PKCS5Padding algorithm, which is tested and working, which pads the data first.  I cant find any information on how to switch the encryption mode in the Go AES package (it's definitely not in <a href="http://golang.org/pkg/crypto/aes/">the docs</a>).  </p>
  
  <p>I have this code in another language, which is how I know this algorithm isn't working quite correctly.</p>
  
  <p>EDIT:  Here is the method as I have interpreted from on the issue page</p>
  
  <pre><code>func AESECB(ciphertext []byte) []byte {
      cipher, _ := aes.NewCipher([]byte(KEY))
      fmt.Println("AESing the data")
      bs := 16
      if len(ciphertext)%bs != 0     {
          panic("Need a multiple of the blocksize")
      }
  
      plaintext := make([]byte, len(ciphertext))
      for len(plaintext) &gt; 0 {
          cipher.Decrypt(plaintext, ciphertext)
          plaintext = plaintext[bs:]
          ciphertext = ciphertext[bs:]
      }
      return plaintext
  }
  </code></pre>
  
  <p>This is actually not returning any data, maybe I screwed something up when changing it from encripting to decripting</p>