Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Hashids and Perceptual hashes
Search
Jens Segers
April 29, 2015
Technology
2
130
Hashids and Perceptual hashes
PHP Ghent presentation
Jens Segers
April 29, 2015
Tweet
Share
More Decks by Jens Segers
See All by Jens Segers
Building a digital ID card for authentication
jenssegers
0
43
JSON Web Tokens in a microservice architecture (PHPBenelux)
jenssegers
0
510
JSON Web Tokens - PHP Antwerp
jenssegers
0
200
Testing API's with Behat
jenssegers
0
340
Apps for Ghent - Realo
jenssegers
0
310
An introduction to automated development environment and Laravel Homestead
jenssegers
0
240
Git 101
jenssegers
1
190
Other Decks in Technology
See All in Technology
社内報はAIにやらせよう / Let AI handle the company newsletter
saka2jp
8
1.3k
AWS IoT 超入門 2025
hattori
0
280
from Sakichi Toyoda to Agile
kawaguti
PRO
1
110
OpenAI gpt-oss ファインチューニング入門
kmotohas
2
1.1k
Adminaで実現するISMS/SOC2運用の効率化 〜 アカウント管理編 〜
shonansurvivors
4
420
実装で解き明かす並行処理の歴史
zozotech
PRO
1
650
許しとアジャイル
jnuank
1
140
Adapty_東京AI祭ハッカソン2025ピッチスライド
shinoyamada
0
220
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
9.1k
『バイトル』CTOが語る! AIネイティブ世代と切り拓くモノづくり組織
dip_tech
PRO
1
110
生成AIとM5Stack / M5 Japan Tour 2025 Autumn 東京
you
PRO
0
240
衛星画像超解像化によって実現する2D, 3D空間情報の即時生成と“AI as a Service”/ Real-time generation spatial data enabled_by satellite image super-resolution
lehupa
0
120
Featured
See All Featured
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
285
14k
Side Projects
sachag
455
43k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.7k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.7k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Embracing the Ebb and Flow
colly
88
4.8k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
Testing 201, or: Great Expectations
jmmastey
45
7.7k
Transcript
None
@jenssegers Jens Segers
Hashids hashids/hashids
youtube.com/watch?v=dQw4w9WgXcQ
Why id obfuscation? Hiding application internals Reduces chance for URL
guessing Hide number of users, articles, … More difficult for scrapers
Encoding ids $hashids = new Hashids\Hashids('salt'); $encodedId = $hashids->encode(123); $hashids
= new Hashids\Hashids('salt'); $decodedId = $hashids->decode('Mj3')[0]; Decoding ids
Perceptual hashes jenssegers/imagehash
Removing thumbnails and duplicate images
#b40b2980dcbd08a #c1e9ee950f0e56cc Different from cryptographic hashing
Perceptual fingerprint No avalanche effect Comparing hashes Similar images =
similar hashes
Hamming Distance Number of different individual bits gmp_hamdist(0b10100110001, 0b10100110101) =
1
None
None
None
None
0000000000000010000000110000011100001111000111110110111111111111
0000000000000010000000110000011100001111000111110110111111111111 1011000110001000111110000000010100100111110100000100010100001010
Calculating the hash Using a different implementation: use Jenssegers\ImageHash\ImageHash; $hasher
= new ImageHash; $hash = $hasher->hash('path/to/image.jpg'); use Jenssegers\ImageHash\Implementation\AverageHash; $hasher = new ImageHash(new AverageHash); $hash = $hasher->hash('path/to/image.jpg');
Comparing hashes Or use your database: $d = $hasher->compare('image1.jpg', 'image2.jpg');
$d = $hasher->distance($hash1, $hash2); SELECT BIT_COUNT(hash ^ :hash) as hamming_distance FROM images HAVING hamming_distance < 5
@jenssegers Jens Segers