anishathalye/neural-hash-collider — dự án mã nguồn mở — đang có 676 sao GitHub. Preimage attack against NeuralHash 💣
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
NeuralHash is a perceptual hash
function that uses a neural
network. Images are resized to 360x360 and passed through a neural network to
produce a 128-dimensional feature vector. Then, the vector is projected onto
R^96 using a 128x96 "seed" matrix. Finally, to produce a 96-bit hash, the
96-dimensional vector is thresholded: negative entries turn into a 0 bit, and
non-negative entries turn into a 1 bit.
This entire process, except for the thresholding, is differentiable, so we can
use gradient descent to find hash collisions. This is a well-known property of
neural networks, that they are vulnerable to adversarial
examples.
We can define a loss that captures how close an image is to a given target
hash: this loss is basically just the NeuralHash algorithm as described above,
but with the final "hard" thresholding step tweaked so that it is "soft" (in
particular, differentiable). Exactly how this is done (choices of activation
functions, parameters, etc.) can affect convergence, so it can require some
experimentation. After choosing the loss function, we can follow the standard
method to find adversarial examples for neural networks: gradient descent.
Details
The implementation currently does an alternating projections style attack to
find an adversarial example that has the intended hash and also looks similar
to the original. See collide.py for the full details. The implementation uses
two different loss functions: one measures the distance to the target hash, and
the other measures the quality of the perturbation (l2 norm + total variation).
We first optimize for a collision, focusing only on matching the target hash.
Once we find a projection, we alternate between minimizing the perturbation and
ensuring that the hash value does not change. The attack has a number of
parameters; run python collide.py --help or refer to the code for a full
list. Tweaking these parameters can make a big difference in convergence time
and the quality of the output.
The implementation also supports a flag --blur [sigma] that blurs the
perturbation on every step of the search. This can slow down or break
convergence, but on some examples, it can be helpful for getting results that
look more natural and less like glitch art.
Examples
Reproducing the Lena/Barbara result from this post:
The first image above is the original Lena image. The second was produced with --target a426dae78cc63799d01adc32 to collide with Barbara. The third was produced with the additional argument --blur 1.0. The fourth is the original Barbara image. Checking their hashes:
Reproducing the Picard/Sidious result from this post:
The first image above is the original Picard image. The second was produced with --target e34b3da852103c3c0828fbd1 --tv-weight 3e-4 to collide with Sidious. The third was produced with the additional argument --blur 0.5. The fourth is the original Sidious image. Checking their hashes:
Get Apple's NeuralHash model following the instructions in
AsuharietYgvar/AppleNeuralHash2ONNX and either put all the
files in this directory or supply the --model / --seed arguments
Run python collide.py --image [path to image] --target [target hash] to
generate a hash collision. Run python collide.py --help to see all the
options, including some knobs you can tweak, like the learning rate and some
other parameters.
Limitations
The code in this repository is intended to be a demonstration, and perhaps a
starting point for other exploration. Tweaking the implementation (choice of
loss function, choice of parameters, etc.) might produce much better results
than this code currently achieves.
Citation
@misc{athalye2021neuralhashcollider,
author = {Anish Athalye},
title = {NeuralHash Collider},
year = {2021},
howpublished = {\url{https://github.com/anishathalye/neural-hash-collider}},
}
anishathalye/neural-hash-collider có bao nhiêu sao?
anishathalye/neural-hash-collider có 676 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/anishathalye/neural-hash-collider. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
anishathalye/neural-hash-collider có tag gì không?
Bản đồng bộ chưa ghi nhận topic GitHub nào cho anishathalye/neural-hash-collider. GitHub topics hiển thị ở thanh bên phải trang repo — đó là nơi đáng kiểm tra nhất.
anishathalye/neural-hash-collider có trang demo không?
Dự án có trang chủ ở https://twitter.com/anishathalye/status/1428164089231069187. Tab "Readme" ở trang này thường có ảnh chụp và hướng dẫn bắt đầu nhanh.
anishathalye/neural-hash-collider còn đang phát triển không?
Commit gần nhất trên anishathalye/neural-hash-collider là 1.2 năm trước (theo timestamp GitHub). Repo có 34 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
anishathalye/neural-hash-collider dùng license gì?
anishathalye/neural-hash-collider phát hành theo license MIT. Nên mở file LICENSE trên GitHub để xác nhận — license metadata đôi khi lệch với thực tế dự án.
anishathalye/neural-hash-collider viết bằng ngôn ngữ gì?
anishathalye/neural-hash-collider chủ yếu viết bằng Python. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Đọc thêm về anishathalye/neural-hash-collider ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/anishathalye/neural-hash-collider là nguồn chính thức.
Đọc đầy đủ README ở tab phía trên.
neural-hash-collider có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về neural-hash-collider.