HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
abevoelker
gfc64
Ruby2023–2024
abevoelker / gfc64

gfc64

Obscures database sequential primary keys (or any 64-bit int) using a Feistel cipher. Throw away your UUIDs!

2Distinct people
2Mentions
0Explicit recommenders
9GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Obscures database sequential primary keys (or any 64-bit int) using a Feistel cipher. Throw away your UUIDs!

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by week2 dated mentions

Observed mentions: 2023-11-25 20:31:30 UTC to 2024-02-18 01:23:57 UTC. Weeks start Monday, UTC.

012023-11-20 00:00:00 UTC to 2023-11-27 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsNov 202023-11-27 00:00:00 UTC to 2023-12-04 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-12-04 00:00:00 UTC to 2023-12-11 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-12-11 00:00:00 UTC to 2023-12-18 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-12-18 00:00:00 UTC to 2023-12-25 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-12-25 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-01-01 00:00:00 UTC to 2024-01-08 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 commentsJan 12024-01-08 00:00:00 UTC to 2024-01-15 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-01-15 00:00:00 UTC to 2024-01-22 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-01-22 00:00:00 UTC to 2024-01-29 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-01-29 00:00:00 UTC to 2024-02-05 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-02-05 00:00:00 UTC to 2024-02-12 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-02-12 00:00:00 UTC to 2024-02-19 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsFeb 12

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
Nov 202023-11-20 00:00:00 UTC2023-11-27 00:00:00 UTC101
Nov 272023-11-27 00:00:00 UTC2023-12-04 00:00:00 UTC000
Dec 42023-12-04 00:00:00 UTC2023-12-11 00:00:00 UTC000
Dec 112023-12-11 00:00:00 UTC2023-12-18 00:00:00 UTC000
Dec 182023-12-18 00:00:00 UTC2023-12-25 00:00:00 UTC000
Dec 252023-12-25 00:00:00 UTC2024-01-01 00:00:00 UTC000
Jan 12024-01-01 00:00:00 UTC2024-01-08 00:00:00 UTC000
Jan 82024-01-08 00:00:00 UTC2024-01-15 00:00:00 UTC000
Jan 152024-01-15 00:00:00 UTC2024-01-22 00:00:00 UTC000
Jan 222024-01-22 00:00:00 UTC2024-01-29 00:00:00 UTC000
Jan 292024-01-29 00:00:00 UTC2024-02-05 00:00:00 UTC000
Feb 52024-02-05 00:00:00 UTC2024-02-12 00:00:00 UTC000
Feb 122024-02-12 00:00:00 UTC2024-02-19 00:00:00 UTC101

What Hacker News says

2 sources
The point about the storage size of UUID columns is unconvincing. 128 bits vs. 64 bits doesn't matter much when the table has five other columns. A much more salient concern for me is performance. UUIDv4 is widely supported but is completely random, which is not ideal for index performance. UUIDv7[0] is closer to Snowflake[1] and has some temporal locality but is less widely implemented. There's an orthogonal approach which is using bigserial and encrypting the keys: https://github.com/abevoelker/gfc64 But this means 1) you can't rotate the secret and 2) if it's ever leaked everyone can now Fermi-estimate your table sizes. Having separate public and internal IDs seems both tedious and sacrifices performance (if the public-facing ID is a UUIDv4). I think UUIDv7 is the solution that checks the most boxes. [0]: https://uuid7.com/ [1]: https:
Read the rest
In My notes on Gitlab's Postgres schema design (2022)
I wrote a Ruby gem to address this problem of hiding sequential primary keys that uses a Feistel network to effectively shuffle int64 IDs: https://github.com/abevoelker/gfc64 So instead of /customers/1 /customers/2 You'll get something like /customers/4552956331295818987 /customers/3833777695217202560 Kinda similar idea to this library but you're encoding from an integer to another integer (i.e. it's format-preserving encryption). I like keeping the IDs as integers without having to reach for e.g. UUIDs
In Sqids – Generate short unique IDs from numbers

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.