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

How Can Be Adding a New Item to a Dynamic Array Achieved in Constant Time?

Based on the previous article titled “Exploring Internal Implementation of Go Slice,” we know that a dynamic array is a data structure that can grow and shrink as needed, which is called resizing. As seen in the implementation, resizing is an expensive operation because it involves copying all the items from the old array to the new array. This resizing is performed only when the array is full. Since the capacity is doubled each time the array is resized, the resizing operation will be less frequent as the array grows....

October 27, 2023 · 4 min · 704 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