This article is a mirror article of machine translation, please click here to jump to the original article.

View: 285|Reply: 1

[Source] .NET/C# Sqids(Hashids) algorithm for digital encryption and decryption

[Copy link]
Posted on 2025-10-8 11:02:27 | | | |
Requirements: The database article table uses int type as the main key, if the website articles are all named by numeric numbers, it is very easy to use loops to collect article content. How can I prevent others from collecting numerical types of articles?

Hashids.net (old name)

A small .NET package for generating YouTube-like IDs from numbers. It converts numbers (e.g. 347 into strings (e.g. yr8) or arrays of numbers (e.g. ) [27, 986] to 3kTMd. You can also decode these IDs back. This is useful when bundling multiple parameters into one, hiding the actual IDs, or simply using them as short string IDs.

Source:The hyperlink login is visible.

Sqids (new name)

Hashids has been upgraded and renamed to Sqids, and the original author of the Hashids algorithm has been renamed and created a new algorithm called "sqids". Sqids (pronounced "squids") is an open-source library that allows you to generate short, unique identifiers based on numbers. These IDs are safe to use in URLs, can encode multiple numbers, and do not contain common profanity.

Sqids (pronounced "squids") is a small library that allows you to generate YouTube-like IDs from numbers. It encodes a number like 127 into a string like yc3, which you can then decode back to the original number. Sqids can be handy when you want to confuse numbers, such as consecutive numeric IDs, into seemingly random strings for use in URLs and other locations.

Source:The hyperlink login is visible.
Documentation:The hyperlink login is visible.

The test code is as follows:

As shown below:





Previous:A brief introduction to PYUSD, a blockchain PayPal stablecoin
Next:OneKey Pro cryptocurrency hardware wallet purchase tutorial
 Landlord| Posted on 2025-10-8 11:11:18 |
Encapsulated as a singleton



Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com