ShadowID: Expose the Auto Increment ID to Public Without Compromising Security

I was tasked to update our existing implementation that uses Auto Increment ID from MySQL as the ID for the public API. The objective of this task is to prevent enumeration attacks1 and ensure that the development effort is kept to a minimum. The first thing that came to mind was to use a unique random ID like UUIDv42. However, since we are using MySQL as the database, indexing UUIDs has a significant performance impact3 due to their randomness and the locality problem of the B-Tree Index4....

October 28, 2023 · 10 min · 1995 words · Jose Sitanggang

Exploring Internal Implementation of Go Slice

This blog is based on what I learned from reading the “Go Slices: Usage and Internals” blog post. When I read that blog post, I got curious and wanted to create my own version of a slice in a low-level language like C++. I wanted to understand how slices work in Go on a deeper level. I also wanted to confirm something mentioned in the Go Documentation they say that: slices are always passed by value, but they don’t copy all the data....

October 22, 2023 · 9 min · 1745 words · Jose Sitanggang

Boosting String and Bytes Conversions Speed by 140x with Zero Allocation in Go

Converting between a string and bytes requires allocating new memory. However, strings and bytes (which are essentially slices of bytes) share a similar memory structure. The main difference is that a slice can grow as needed, while a string remains immutable. We can gain insights into their internal structures by referring to the Go documentation. Strings are defined using StringHeader, while slices are defined using SliceHeader. To enhance clarity, we’ll include these definitions here:...

October 21, 2023 · 4 min · 706 words · Jose Sitanggang