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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
58
JSON Web Tokens in a microservice architecture (PHPBenelux)
jenssegers
0
540
JSON Web Tokens - PHP Antwerp
jenssegers
0
220
Testing API's with Behat
jenssegers
0
370
Apps for Ghent - Realo
jenssegers
0
320
An introduction to automated development environment and Laravel Homestead
jenssegers
0
250
Git 101
jenssegers
1
190
Other Decks in Technology
See All in Technology
Bill One 開発エンジニア 紹介資料
sansan33
PRO
5
18k
AWS Systems Managerのハイブリッドアクティベーションを使用したガバメントクラウド環境の統合管理
toru_kubota
0
160
Copilot 宇宙へ 〜生成AIで「専門データの壁」を壊す方法〜
nakasho
0
180
20260323_データ分析基盤でGeminiを使う話
1210yuichi0
0
180
韓非子に学ぶAI活用術
tomfook
2
500
Agent Skill 是什麼?對軟體產業帶來的變化
appleboy
0
230
The Rise of Browser Automation: AI-Powered Web Interaction in 2026
marcthompson_seo
0
310
ABEMAのバグバウンティの取り組み
kurochan
1
690
From Senior to Staff : To infinity and beyond !
kuahyeow
0
110
Phase03_ドキュメント管理
overflowinc
0
2.4k
開発チームとQAエンジニアの新しい協業モデル -年末調整開発チームで実践する【QAリード施策】-
kaomi_wombat
0
240
Phase04_ターミナル基礎
overflowinc
0
2.2k
Featured
See All Featured
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.1k
First, design no harm
axbom
PRO
2
1.1k
Raft: Consensus for Rubyists
vanstee
141
7.4k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.7k
Designing for Performance
lara
611
70k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
180
The Cult of Friendly URLs
andyhume
79
6.8k
Heart Work Chapter 1 - Part 1
lfama
PRO
5
35k
Google's AI Overviews - The New Search
badams
0
940
Evolving SEO for Evolving Search Engines
ryanjones
0
170
Producing Creativity
orderedlist
PRO
348
40k
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