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
140
2
Share
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
62
JSON Web Tokens in a microservice architecture (PHPBenelux)
jenssegers
0
550
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
190
Other Decks in Technology
See All in Technology
GKE Agent SandboxでAIが生成したコードを 安全に実行してみた
lamaglama39
0
180
FessのAI検索モード:検索システムとLLMへの取り組み
marevol
0
220
AI와 협업하는 조직으로의 여정
arawn
0
580
Forget technical debt
ufried
0
160
雑談は、センサーだった
bitkey
PRO
2
190
MySQL 9.7がやってきた ~これまでのあらすじと基本情報~ @ 日本MySQLユーザ会会2026年04月 / mysql97-yattekita
sakaik
0
170
カオナビに Suspenseを導入するまで / The Road to Suspense at kaonavi
kaonavi
1
260
バイブコーディングで3倍早く⚪⚪を作ってみた
samakada
0
210
Anthropic「Long-running a gents」をGeminiで再現してみた
tkikuchi
0
770
ブラウザの投機的読み込みと投機ルールAPIを理解し、Webサービスのパフォーマンスを最適化する
shuta13
3
270
Fabric MCPの紹介と使い分け
ryomaru0825
1
110
AI活用時代の事業判断高度化を導くエンジニアリング基盤 / 20260424 Atsushi Funahashi
shift_evolve
PRO
2
130
Featured
See All Featured
We Are The Robots
honzajavorek
0
220
How to make the Groovebox
asonas
2
2.1k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
380
The Limits of Empathy - UXLibs8
cassininazir
1
320
The browser strikes back
jonoalderson
0
1k
How to Think Like a Performance Engineer
csswizardry
28
2.6k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.9k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
110
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
180
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.4k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
130
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