GeistHaus
log in · sign up

binary

golang.org

Package binary implements simple translation between numbers and byte sequences and encoding and decoding of varints.

4 pages link to this URL
Windows Filetime Timestamps and Byte Wrangling with Go

For a side project, I have to parse timestamps in a file. These timestamps are in the Windows Filetime format. This post documents what I have learned about them and how they can be converted to a Golang time.Time and then converted to any desirable format after that. We will start by looking at endian-ness and use a real-world example to practice our newly acquired knowledge. TL;DR: To convert a Windows Filetime to Go's time.Time: Read 8 bytes in LittleEndian from the file. Create a syscall.Filetime. Assign the first 4 bytes to LowDateTime field and the other four to HighDateTime. Convert the resulting Filetime to nanoseconds with Filetime.Nanoseconds(). Convert the resulting value to time.Time. The code is at: https://github.com/parsiya/Parsia-Code/tree/master/filetime-bytewrangling

0 inbound links en [Parsia Hakimian Parsiya infosec information security]
Life without line numbers

If you are desperate for 6% smaller Go binaries, this blog post is for you. (I did this experiment to help out Tailscale. Disclosure: I’m an investor.) If binary size doesn’t worry you, well, maybe you’ll find it entertaining. In order to get example numbers for this post, I grabbed a random item from my GOPATH. All the hard numbers in this blog post are for github.com/mvdan/sh/cmd/shfmt. From a bit of experimenting, they seem fairly representative.

1 inbound link article en post