There are no reviews yet. Be the first to send feedback to the community and the maintainers!
.:. LIBPUZZLE .:. http://libpuzzle.pureftpd.org ------------------------ BLURB ------------------------ The Puzzle library is designed to quickly find visually similar images (gif, png, jpg), even if they have been resized, recompressed, recolored or slightly modified. The library is free, lightweight yet very fast, configurable, easy to use and it has been designed with security in mind. This is a C library, but it also comes with a command-line tool and PHP bindings. ------------------------ REFERENCE ------------------------ The Puzzle library is a implementation of "An image signature for any kind of image", by H. CHI WONG, Marschall BERN and David GOLDBERG. ------------------------ COMPILATION ------------------------ In order to load images, the library relies on the GD2 library. You need to install gdlib2 and its development headers before compiling libpuzzle. The GD2 library is available as a pre-built package for most operating systems. Debian and Ubuntu users should install the "libgd2-dev" or the "libgd2-xpm-dev" package. Gentoo users should install "media-libs/gd". OpenBSD, NetBSD and DragonflyBSD users should install the "gd" package. MacPorts users should install the "gd2" package. X11 support is not required for the Puzzle library. Once GD2 has been installed, configure the Puzzle library as usual: ./configure This is a standard autoconf script, if you're not familiar with it, please have a look at the INSTALL file. Compile the beast: make Try the built-in tests: make check If everything looks fine, install the software: make install If anything goes wrong, please submit a bug report to: libpuzzle [at] pureftpd [dot] org ------------------------ USAGE ------------------------ The API is documented in the libpuzzle(3) and puzzle_set(3) man pages. You can also play with the puzzle-diff test application. See puzzle-diff(8) for more info about the puzzle-diff application. In order to be thread-safe, every exported function of the library requires a PuzzleContext object. That object stores various run-time tunables. Out of a bitmap picture, the Puzzle library can fill a PuzzleCVec object : PuzzleContext context; PuzzleCVec cvec; puzzle_init_context(&context); puzzle_init_cvec(&context, &cvec); puzzle_fill_cvec_from_file(&context, &cvec, "directory/filename.jpg"); The PuzzleCvec structure holds two fields: signed char *vec: a pointer to the first element of the vector size_t sizeof_vec: the number of elements The size depends on the "lambdas" value (see puzzle_set(3)). PuzzleCvec structures can be compared: d = puzzle_vector_normalized_distance(&context, &cvec1, &cvec2, 1); d is the normalized distance between both vectors. If d is below 0.6, pictures are probably similar. If you need further help, feel free to subscribe to the mailing-list (see below). ------------------------ INDEXING ------------------------ How to quickly find similar pictures, if they are millions of records? The original paper has a simple, yet efficient answer. Cut the vector in fixed-length words. For instance, let's consider the following vector: [ a b c d e f g h i j k l m n o p q r s t u v w x y z ] With a word length (K) of 10, you can get the following words: [ a b c d e f g h i j ] found at position 0 [ b c d e f g h i j k ] found at position 1 [ c d e f g h i j k l ] found at position 2 etc. until position N-1 Then, index your vector with a compound index of (word + position). Even with millions of images, K = 10 and N = 100 should be enough to have very little entries sharing the same index. Here's a very basic sample database schema: +-----------------------------+ | signatures | +-----------------------------+ | sig_id | signature | pic_id | +--------+-----------+--------+ +--------------------------+ | words | +--------------------------+ | pos_and_word | fk_sig_id | +--------------+-----------+ I'd recommend splitting at least the "words" table into multiple tables and/or servers. By default (lambas=9) signatures are 544 bytes long. In order to save storage space, they can be compressed to 1/third of their original size through the puzzle_compress_cvec() function. Before use, they must be uncompressed with puzzle_uncompress_cvec(). ------------------------ PUZZLE-DIFF ------------------------ A command-line tool is also available for scripting or testing. It is installed as "puzzle-diff" and comes with a man page. Sample usage: - Output distance between two images: $ puzzle-diff pic-a-0.jpg pics-a-1.jpg 0.102286 - Compare two images, exit with 10 if they look the same, exit with 20 if they don't (may be useful for scripts): $ puzzle-diff -e pic-a-0.jpg pics-a-1.jpg $ echo $? 10 - Compute distance, without cropping and with computing the average intensity of the whole blocks: $ puzzle-diff -p 1.0 -c pic-a-0.jpg pic-a-1.jpg 0.0523151 ------------------------ COMPARING IMAGES WITH PHP ------------------------ A PHP extension is bundled with the Libpuzzle package, and it provides PHP bindings to most functions of the library. Documentation for the Libpuzzle PHP extension is available in the README-PHP file. ------------------------ APPS USING LIBPUZZLE ------------------------ Here are third-party projects using libpuzzle: * ftwin - http://jok.is-a-geek.net/ftwin.php ftwin is a tool useful to find duplicate files according to their content on your file system. * Python bindings for libpuzzle: PyPuzzle https://github.com/ArchangelSDY/PyPuzzle ------------------------ STATUS ------------------------ This project is unfortunately not maintained any more. Pull requests are always welcome, but I don't use this library any more and I don't have enough spare time to actively work on it.
libsodium
A modern, portable, easy to use crypto library.dsvpn
A Dead Simple VPN.piknik
Copy/paste anything over the network.minisign
A dead simple tool to sign files and verify digital signatures.libsodium.js
libsodium compiled to Webassembly and pure JavaScript, with convenient wrappers.libhydrogen
A lightweight, secure, easy-to-use crypto library suitable for constrained environments.pure-ftpd
Pure FTP serverlibsodium-php
The PHP extension for libsodium.swift-sodium
Safe and easy to use crypto for iOS and macOSedgedns
A high performance DNS cache designed for Content Delivery Networksiptoasn-webservice
Web service to map IP addresses to AS information, using iptoasn.comdnsblast
A simple and stupid load testing tool for DNS resolversas-wasi
An AssemblyScript API layer for WASI system calls.rust-jwt-simple
A secure, standard-conformant, easy to use JWT implementation for Rust.wasm-crypto
A WebAssembly (via AssemblyScript) set of cryptographic primitives for building authentication and key exchange protocols.rust-bloom-filter
A fast Bloom filter implementation in Rustencpipe
The dum^H^H^Hsimplest encryption tool in the world.Pincaster
A fast persistent nosql database with a HTTP/JSON interface, not only for geographical data.UCarp
UCARP allows a couple of hosts to share common virtual IP addresses in order to provide automatic failover. It is a portable userland implementation of the secure and patent-free Common Address Redundancy Protocol (CARP, OpenBSD's alternative to the patents-bloated VRRP).blacknurse
BlackNurse attack PoClibsodium-doc
Gitbook documentation for libsodiumbitbar-dnscrypt-proxy-switcher
BitBar plugin to control dnscrypt-proxy usagecharm
A really tiny crypto library.witx-codegen
WITX code and documentation generator for AssemblyScript, Zig, Rust and more.siphash-js
A Javascript implementation of SipHash-2-4rust-ed25519-compact
Small, wasm-friendly, zero-dependencies Ed25519 and X25519 implementation for Rust.rsign2
A command-line tool to sign files and verify signatures in pure Rust.go-minisign
Minisign verification library for Golang.rust-nats
A simple NATS client library for Rustzigly
The easiest way to write services for Fastly's Compute@Edge in Zig.was-not-wasm
A hostile memory allocator to make WebAssembly applications more predictable.webassembly-benchmarks
Libsodium WebAssembly benchmarks results.rust-minisign
A pure Rust implementation of the Minisign signature tool.zig-charm
A Zig version of the Charm crypto library.rust-ffmpeg-wasi
ffmpeg 7 libraries precompiled for WebAsembly/WASI, as a Rust crate.openssl-wasm
OpenSSL 3 compiled for WebAssembly/WASI (up-to-date, maintained)rust-sthash
Very fast cryptographic hashing for large messages.vtun
A mirror of VTUN, with some changesiptrap
A simple, but damn fast sinkholeboringssl-wasm
BoringSSL for WebAssembly/WASIlibsodium-signcryption
Signcryption using libsodium.wasmsign
A tool to add and verify digital signatures to/from WASM binarieslibaegis
Portable C implementations of the AEGIS family of high-performance authenticated encryption algorithms.blobcrypt
Authenticated encryption for streams and arbitrary large files using libsodiumrust-coarsetime
Time and duration crate optimized for speedzig-minisign
Minisign reimplemented in Zig.rust-siphash
SipHash (2-4, 1-3 + 128 bit variant) implementations for Rust6Jack
A framework for analyzing/testing/fuzzing network applications.rust-hyperloglog
A HyperLogLog implementation in Rust.libchloride
Networking layer for libsodium, based on CurveCPrust-qptrie
A qp-trie implementation in Rustminicsv
A tiny, fast, simple, single-file, BSD-licensed CSV parsing library in C.spake2-ee
A SPAKE2+ Elligator Edition implementation for libsodium 1.0.16+massresolver
Mass DNS resolution toolcpace
A CPace PAKE implementation using libsodium.aegis-X
The AEGIS-128X and AEGIS-256X high performance ciphers.rust-privdrop
A simple Rust crate to drop privilegesPureDB
PureDB is a portable and tiny set of libraries for creating and reading constant databases.libclang_rt.builtins-wasm32.a
The missing libclang_rt.builtins-wasm32.a file to compile to WebAssembly.c-ipcrypt
ipcrypt implementation in Crust-dnsclient
A simple and secure DNS client crate for Rust.rust-xoodyak
Xoodyak, a lightweight and versatile cryptographic scheme implemented in Rust.fastly-terrarium-examples
Example code you can run in Fastly Terrarium: https://www.fastlylabs.com/libsodium-xchacha20-siv
Deterministic/nonce-reuse resistant authenticated encryption scheme using XChaCha20, implemented on libsodium.rust-geoip
GeoIP bindings for Rustrust-minisign-verify
A small Rust crate to verify Minisign signatures.whatsmyresolver
A tiny DNS server that returns the client (resolver) IPlibsodium-sys-stable
Sodiumoxide's libsodium-sys crate, but that installs stable versions of libsodium.spritz
A C implementation of Spritz, a spongy RC4-like stream cipher and hash function.metrohash-c
C version of the MetroHash functionrust-hmac-sha256
A small, self-contained SHA256 and HMAC-SHA256 implementation.rust-cpace
A Rust implementation of CPace, a balanced PAKE.rust-clockpro-cache
CLOCK-Pro cache replacement algorithm for Rustrust-blind-rsa-signatures
RSA blind signatures in RustPHP-OAuth2-Provider
Skyrock OAuth2 serverrust-aegis
AEGIS high performance ciphers for Rust.system-tuning-for-crypto
System tuning recommendations for running cryptographic applicationshashseq
A simple proof of work, mainly designed to mitigate DDoS attacks.dnssector
A DNS library for Rust.openssl-family-bench
A quick benchmark of {Open,Libre,Boring}SSLranden-rng
A port of the Google Randen fast backtracking-resistant random generator to the C language.Blogbench
A filesystem benchmark tool that simulates a realistic loadvue-dnsstamp
DNS Stamp calculator component for VueJSsupercop
Always up-to-date mirror of the SUPERCOP cryptographic benchmark.yaifo
YAIFO [remote OpenBSD installer] for OpenBSD-currentratelimit
Plug-and-play IP rate limiter in Cdraft-aegis-aead
The AEGIS cipher family - Draft.go-hpke-compact
A small and easy to use HPKE implementation in Go.ipgrep
Extract, defang, resolve names and IPs from textzig-rocca-s
An implementation of the ROCCA-S encryption scheme.Simple-Comet-Server
HTTP long-polling server and javascript client library.simpira384
An AES-based 384 bit permutation.PHP-WebDAV-extension
The PHP WebDAV extension allows easy access to remote resources with PHP through the DAV protocol.nonce-extension
Make AES-GCM safe to use with random nonces, for any practical number of messages.rust-sealed_box
Sealed boxes implementation for Rust/WebAssembly.zig-eddsa-key-blinding
A Zig implementation of EdDSA signatures with blind keys.c-blind-rsa-signatures
Blind RSA signatures for OpenSSL/BoringSSL.aes-torture
A software AES implementation to torture code generators.js-base64-ct
Safe Base64 encoding/decoding in pure JavaScript.rust-aes-wasm
Fast(er) AES-based constructions for WebAssembly and Rust.Love Open Source and this site? Check out how you can help us