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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Jens Segers
April 29, 2015
Technology
140
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
68
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
380
Apps for Ghent - Realo
jenssegers
0
330
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
日本 Fintech 未来予測レポート 2027〜2028年(手動編集版)
8maki
0
2.4k
Claude Codeをどのように キャッチアップしているか
oikon48
13
8.4k
日本 Fintech 未来予測レポート 2027〜2028年(オリジナル版)
8maki
0
2.3k
iAEONの段階的リアーキテクト戦略 / iAEON's_Gradual_Re-architecture_Strategy
aeonpeople
0
220
白金鉱業Meetup_Vol.24_「AIエージェントは分けるほど良い」は本当か? / Is it true that “the more you divide AI agents, the better”?
brainpadpr
1
410
スキルと MCP ツール、責務をどう分けるか? AI が迷わないインターフェース設計の戦略
cdataj
1
1.1k
SONiCの統計情報を取得したい
sonic
0
190
気軽に使える"情報のハブ"としてのNotion活用 〜フロー情報の集積点 と、 Claude Code × Notion AI〜
syucream
1
150
やさしいA2A入門
minorun365
PRO
12
1.9k
Snowflakeと仲良くなる第一歩
coco_se
4
500
フィジカル版Github Onshapeの紹介
shiba_8ro
0
270
Bucharest Tech Week 2026 - Reinventing testing practices in the AI era
edeandrea
PRO
1
160
Featured
See All Featured
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
71
40k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.9k
Producing Creativity
orderedlist
PRO
348
40k
Site-Speed That Sticks
csswizardry
13
1.2k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.2k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
1
200
Scaling GitHub
holman
464
140k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Building the Perfect Custom Keyboard
takai
2
800
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
340
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