Get started with hashids CDN
MIT licensed
Hashids is a library for encoding and decoding human-friendly IDs from hash values.
Tags:- hashids
- hashid
- hash
- ids
- youtube
- bitly
- obfuscate
- encode
- decode
- encrypt
- decrypt
Stable version
Copied!
How to start using hashids CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with hashids CDN - cdnhub.io</title>
<script src="https://cdn.cdnhub.io/hashids/2.3.0/hashids.min.js"></script>
</head>
<body>
<button id="encode">Encode</button>
<button id="decode">Decode</button>
<script>
const HashID = new Hashids('mySalt', 7); // You can change the salt and length as needed
document.getElementById('encode').addEventListener('click', () => {
const id = HashID.encode(1, 2, 3, 4, 5, 6, 7);
console.log('Encoded ID:', id);
});
document.getElementById('decode').addEventListener('click', () => {
const decodedIds = HashID.decode('1234567');
console.log('Decoded IDs:', decodedIds);
});
</script>
</body>
</html>
Copied!
Copied!
Copied!