| Age | Commit message (Collapse) | Author |
|
Package hexdump implements reading and writing bytes from and into
hexadecimal number.
It support parsing output from hexdump(1) tool.
|
|
If networkByteOrder is true, the ParseHexDump read each hex string
in network byte order or as order defined in text.
While at it, fix reading and parsing single byte hex.
|
|
There are several reasons that why we move from github.com.
First, related to the name of package.
We accidentally name the package with "share" a common word in English
that does not reflect the content of repository.
By moving to other repository, we can rename it to better and unique
name, in this "pakakeh.go".
Pakakeh is Minang word for tools, and ".go" suffix indicate that the
repository related to Go programming language.
Second, supporting open source.
The new repository is hosted under sourcehut.org, the founder is known
to support open source, and all their services are licensed under AGPL,
unlike GitHub that are closed sources.
Third, regarding GitHub CoPilot.
The GitHub Terms of Service [1], allow any public content that are hosted
there granted them to parse the content.
On one side, GitHub helps and flourish the open source, but on another
side have an issues regarding scraping the copyleft license [2].
[1]: https://docs.github.com/en/site-policy/github-terms/github-terms-of-service#4-license-grant-to-us
[2]: https://githubcopilotinvestigation.com
|
|
The ParseHexDump parse the default output of [hexdump](1) utility from
parameter in back into stream of byte.
An example of default output of hexdump is
0000000 7865 5f70 6964 2f72 0000 0000 0000 0000
0000010 0000 0000 0000 0000 0000 0000 0000 0000
*
0000060 0000 0000 3030 3030 3537 0035 3030 3130
The first column is the address and the rest of the column is the data.
Each data column is 16-bit words in big-endian order, so in the above
example, the first byte would be 65, second byte is 78 and so on.
The asterisk "*" means that the address from 0000020 to 0000050 is equal to
the previous line, 0000010.
[hexdump]: https://man.archlinux.org/man/hexdump.1
|
|
The TrimNull function remove 0 value ("\0" or NULL in C) at leading
and trailing of input.
|
|
The bytes package, and many other packages in this module, is written
when I still learning and using the Go language for master thesis.
Some of the code, like function signature, does not follow the
Go idiom, at least not how the Go source code looks like.
A breaking changes,
* WriteUint16 and WriteUint32 accept slice only without pointer.
There is no need to pass slice as pointer to function if we want
to modify the content, as long as the backing storage is not
changed.
Bug fixes,
* PrintHex: fix print layout on the last line
* ReadHexByte: fix possible index out of range
* SkipAfterToken return -1 and false if no token found, as promised
in the comment, instead of the length of text.
We move all unit test to example so we have test and example in the
documentation at the same time.
This changes make all test coverage 100%.
|
|
Previously, the test.Assert and test.AssertBench functions has the
boolean parameter to print the stack trace of test in case its not equal.
Since this parameter is not mandatory and its usually always set to
"true", we remove them from function signature to simplify the call
to Assert and AssertBench.
|
|
|
|
The function MergeSpaces will convert sequences of white space into
single space ' '.
|
|
|
|
|
|
This library previously part of bytes package. To make it bytes package
consistent (only working with slice of byte), we move all ASCII related
constants, variables, and functions into new package.
|
|
|
|
|
|
If you familiar with go-bindata [1], this method is similar with that.
[1] github.com/shuLhan/go-bindata
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|