Skip to content

Instantly share code, notes, and snippets.

@jamesadney
Last active December 12, 2015 08:48
Show Gist options
  • Save jamesadney/4746481 to your computer and use it in GitHub Desktop.
Save jamesadney/4746481 to your computer and use it in GitHub Desktop.
package main
import "fmt"
import "bytes"
import "io"
var msg = []byte("Hello World this is James")
func main() {
cipherText := bytes.NewBuffer(make([]byte, 0, len(msg)+16))
cipherText.Write([]byte("Hey"))
fmt.Println(cipherText.Bytes())
msgReader := bytes.NewReader(msg)
m_1 := make([]byte, 4)
m_2 := make([]byte, 4)
io.ReadFull(msgReader, m_1)
io.ReadFull(msgReader, m_2)
fmt.Println(string(m_1))
fmt.Println(string(m_2))
// Looping through bufio.Reader
// r := bufio.NewReader(file)
// for line, _, err := r.ReadLine(); err != io.EOF {
// // ...
// }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment