I am using C# with RHash in order to calculate the btih hashes of of file. Currently I'm using 3 tools in order to generate the btih hash:
rhash-1.2.9-src\bindings\mono
with librhash-1.2.9-win
dllrhash-1.2.9-win32
command line tool The problem is that every tool generates different btih signatures for the same file (the photo was taken by me, it's royal free):
1: 2FF7858CC0A0B216C3676A807D619FA30101E45F
2: E6F07BB3C3B3B67531C84E3452980698AC1B0DAA A:\IMG_0400.JPG
3: D0B96839A14A8C45BB81AD157805AE73425998E5
For the C# hash generation I use Hasher.GetHashForFile(f.Name, HashType.BTIH);
and rhash --bith
in the cmd tool.
What am I doing wrong? Is there another way to calculate the btih?
C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...
What is C? C is a general-purpose programming language created by Dennis Ritchie at the Bell Laboratories in 1972. It is a very popular language, despite being old. C is strongly associated with UNIX, as it was developed to write the UNIX operating system.
In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr.
Compared to other languages—like Java, PHP, or C#—C is a relatively simple language to learn for anyone just starting to learn computer programming because of its limited number of keywords.
The difference between the first two is that, according to the RHash
source code, BTIH
hashes requires additional data to be correctly computed.
The init_btih_data
function in calc_sums.c
is documented with:
Initialize BTIH hash function. Unlike other algorithms BTIH requires more data for correct computation.
In test_hashes.c
, the BTIH
examples are actually treated differently depending on whether USE_BTIH_WITH_TEST_FILENAME
has been defined.
That init_btih_data
function (which only seems to get called when running the command line application) in turn calls the rhash_trasmit
function a number of times depending on various parameters. At a minimum, it will call it twice, which probably explains the difference between the first two. It can, however, call it a number of other times, which I think explains the difference we see with uTorrent.
The difficulty is that while the unmanaged DLL exposes the rhash_trasmit
function, the .NET bindings do not, which means that it is not possible to supply the additional data that is expected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With