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
150
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Hashids and Perceptual hashes
PHP Ghent presentation
Jens Segers
April 29, 2015
More Decks by Jens Segers
See All by Jens Segers
Building a digital ID card for authentication
jenssegers
0
80
JSON Web Tokens in a microservice architecture (PHPBenelux)
jenssegers
0
560
JSON Web Tokens - PHP Antwerp
jenssegers
0
220
Testing API's with Behat
jenssegers
0
390
Apps for Ghent - Realo
jenssegers
0
340
An introduction to automated development environment and Laravel Homestead
jenssegers
0
260
Git 101
jenssegers
1
200
Other Decks in Technology
See All in Technology
属人化を叩き割れ!「制作加速」と「安定化」の矛盾を打破する:8年目プロダクトが辿り着いた「ミスが起こり得ない」アセット制作フローの全貌
gree_tech
PRO
0
370
:syncing_time:
sksat
2
630
生成 AI の基礎 〜 サンプル実装で学ぶ基本原理
enakai00
7
4.6k
【CEDEC2026】Creative Approaches to Localizing the Dialects and Unique Speech of Umamusume: Pretty Derby Characters in English
cygames
PRO
4
26k
Kiro Crew入門 - 常駐エージェントの仕組みと使いどころ / Intro to Kiro Crew
k_adachi_01
1
860
AI時代に、人は何を、どう学ぶのか #pbl_pub / What and How Do We Learn in the AI Era?
takaking22
1
240
わたしが知り合いゼロの勉強会に 行けるようになるまで
r5ni4
1
230
三人寄ればチューリング完全
puhitaku
6
3k
ソフトウェアサプライチェーンの構造的リスクとコンテナ環境の保護
kyohmizu
5
890
Rust×eBPFでEDRっぽいものをつくる
sunlife3
2
900
国家プロジェクトを支える「さくらONE」 大規模LLM開発におけるGPU障害を乗り越えるクラスター運用戦略
gpuunite_official
0
270
Genie Codeハンズオン応用編
taka_aki
0
140
Featured
See All Featured
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
210
Unsuck your backbone
ammeep
672
58k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
280
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
710
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
210
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
800
Believing is Seeing
oripsolob
1
200
Bash Introduction
62gerente
615
220k
Designing for Timeless Needs
cassininazir
1
450
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
500
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
11k
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