Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Hashids and Perceptual hashes
Search
Jens Segers
April 29, 2015
Technology
160
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
90
JSON Web Tokens in a microservice architecture (PHPBenelux)
jenssegers
0
570
JSON Web Tokens - PHP Antwerp
jenssegers
0
230
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
260
Git 101
jenssegers
1
200
Other Decks in Technology
See All in Technology
How to Design Configuration for Rails Applications
willnet
1
780
Claude Code本は、どのように執筆チームで書かれたか
oikon48
1
380
しろおびから始める!ログ活用の第一歩
shumei_ito
0
950
遠藤な_めぐろLT #38 「社内のAI活用推進」@麻布台_20261009
endonanana
0
130
CTO Night|NotionのAIエージェントとFDE
kzkhykw1991
0
100
触りたくないデータに、どう触るか AI時代のRBACアクセスガバナンス
ivry_presentationmaterials
0
260
Active Record Connection Adaptersにおける長年の課題に再び取り組む
yahonda
0
150
Metadata - Section 1: HTML Basics
mohab1
0
120
分析の民主化を支えるメタデータ整備の実践
kakehashi
PRO
4
1.4k
Local CI × GitHub Actions
gogutan
2
190
SAENM ~Jupyterで残すPoCの試行錯誤、未来の自分と仲間を助ける記録!~
terapyon
0
110
自作バイナリを動かす「入口」8選
puhitaku
2
1.3k
Featured
See All Featured
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
We Have a Design System, Now What?
morganepeng
55
8.4k
Marketing to machines
jonoalderson
1
5.9k
YesSQL, Process and Tooling at Scale
rocio
174
15k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
58k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.8k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.8k
Agile that works and the tools we love
rasmusluckow
331
22k
Technical Leadership for Architectural Decision Making
baasie
3
600
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
Making Projects Easy
brettharned
120
6.8k
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
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