Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: Cryptography technique to hide monotonically increasing GUIDs
1 point by chipdart on April 9, 2024 | hide | past | favorite | 3 comments
Consider a scenario where a service uses a GUID as an element index and there is a hard requirement for it to be monotonically increasing, but there is also a requirement that this order should not be leaked to clients. Is there any specific cryptographical technique that was designed to hide from clients the relative order of each pair of these GUIDs and still allow services to recover that order?


just encrypt it with symmetric cipher in ECB mode of operation.

For 128-bit GUID use AES-128 is perfect. You can still compare if the two GUIDs are the same without decrypting, but you need to decrypt to get the real GUID.


This is the easiest way to go but it's only obscuring the GUID. Format preserving encryption (FPE) would be another possibility if it's not simply a byte string.


uuids have different versions. Commonly used is version 4 which uses random numbers, but you probably want an uuid version 6 or 7 which use the date and time for generating the uuid. Guid is just another name for them.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: