Logging a ASN.1 DER encoded form produces unreadable characters in terminal



I was using Go to do some RSA stuff, and I logged a ASN.1 DER encoded form out, and the console didn’t like it…

Replicate with the following Go code:

package main

import (

func main () {
    privKey, err := rsa.GenerateKey(rand.Reader, 512)

The text in my console:

└┼≥├:·/┬⎺⎼┐⎽⎻▒ce $ ±⎺ ⎼┤┼ ▒⎼±┤└e┼├⎽↓±⎺ ^C
└┼≥├:·/┬⎺⎼┐⎽⎻▒ce $ ^C
└┼≥├:·/┬⎺⎼┐⎽⎻▒ce $ ^C
└┼≥├:·/┬⎺⎼┐⎽⎻▒ce $ ┌└▒⎺ ⎼☃⎻
b▒⎽▒: ┌└▒⎺: c⎺└└▒┼d ┼⎺├ °⎺┤┼d
└┼≥├:·/┬⎺⎼┐⎽⎻▒ce $ 

Pretty fun stuff!


Discovered a lost language you have.

Help you I cannot.

:older_man: :question:
:mag_right: :accept:


I am the chosen one.


A lifelong adventure of cryptographer awaits you it does.



Dumping binary data into your terminal will spawn cthulhu :octopus:.

$ reset will fix it.

Do take note that this is not cloud9 specific. $ cat simply dumps the data in the file to it’s standard output ( your terminal when you’re not piping the output to something), including control characters which are causing this behavior…