Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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
51
JSON Web Tokens in a microservice architecture (PHPBenelux)
jenssegers
0
530
JSON Web Tokens - PHP Antwerp
jenssegers
0
210
Testing API's with Behat
jenssegers
0
350
Apps for Ghent - Realo
jenssegers
0
320
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
文字列の並び順 / Unicode Collation
tmtms
3
620
AWS CLIの新しい認証情報設定方法aws loginコマンドの実態
wkm2
7
760
生成AI活用の型ハンズオン〜顧客課題起点で設計する7つのステップ
yushin_n
0
250
.NET 10の概要
tomokusaba
0
120
AI駆動開発の実践とその未来
eltociear
1
300
AIの長期記憶と短期記憶の違いについてAgentCoreを例に深掘ってみた
yakumo
4
460
NIKKEI Tech Talk #41: セキュア・バイ・デザインからクラウド管理を考える
sekido
PRO
0
160
RAG/Agent開発のアップデートまとめ
taka0709
0
190
Reinforcement Fine-tuning 基礎〜実践まで
ch6noota
0
190
AI時代のワークフロー設計〜Durable Functions / Step Functions / Strands Agents を添えて〜
yakumo
3
990
Amazon Quick Suite で始める手軽な AI エージェント
shimy
0
650
日本Rubyの会: これまでとこれから
snoozer05
PRO
4
170
Featured
See All Featured
From π to Pie charts
rasagy
0
86
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
0
930
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
310
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
The Language of Interfaces
destraynor
162
25k
KATA
mclloyd
PRO
33
15k
So, you think you're a good person
axbom
PRO
0
1.8k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
0
120
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
115
91k
Documentation Writing (for coders)
carmenintech
77
5.2k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.1k
[RailsConf 2023] Rails as a piece of cake
palkan
58
6.2k
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