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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
75
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
250
Git 101
jenssegers
1
200
Other Decks in Technology
See All in Technology
20260608_Codexの可能性_ノンプログラマー向け_大城追記
doradora09
PRO
0
750
実践が先生だった— 新卒サーバーエンジニア1年目のリアル
mixi_engineers
PRO
0
240
事業価値と Engineering 2026年度版
recruitengineers
PRO
10
2.2k
信頼できるテスティングAIをどう育てるか?
odan611
0
190
変化の早いClaude Codeを 書籍に落とし込む
oikon48
6
1.2k
メルカリのグローバルアプリで挑んだ AlloyDB 運用と課題解決の実践記
hatappi
0
110
【CEDEC2026】コードレビュー支援ツール開発から学ぶ:LLMを用いた業務システムの実践的な運用設計と誤出力対策
cygames
PRO
0
450
侵入は突然に 〜 IoTマルウェアと悪用される家庭の機器 ~ / When Intrusion Strikes: IoT Malware and the Abuse of Home Devices
nttcom
0
1.4k
PLaMo 3.0 Primeの事後学習
pfn
PRO
0
260
20260801_スクフェス大阪
kgnkhkr
1
1k
LLMリーダーボードアップデートに向けたAgentic Math_SWEのトレースについて
nejumi
0
200
Data Hubグループ 紹介資料
sansan33
PRO
0
3.1k
Featured
See All Featured
A better future with KSS
kneath
240
18k
The Limits of Empathy - UXLibs8
cassininazir
1
580
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
330
Discover your Explorer Soul
emna__ayadi
2
1.2k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
420
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
790
ラッコキーワード サービス紹介資料
rakko
1
4.2M
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
200
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Optimising Largest Contentful Paint
csswizardry
37
3.9k
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