aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Author Topic: Insterting file hash in the file's name  (Read 4842 times)

Arichy

  • Full Member
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 224
Insterting file hash in the file's name
« on: December 10, 2005, 06:44:05 PM »

When a file is to be downloaded, check if the file name contains it's ed2k-hash.

If not, insert "." plus the ed2k-hash before the last "." of the filename. If ther is no "." in the file name, append "." plus the hash to it.

Reason:
If You burn downloaded files to cd or dvd or move it, and want to verify the correct burning or moving process, you have just to calculate the hash from the (moved) file on cd/dcd. If it's that of the filename, you know it's ok.

And it is generally easy to check, if a file is the originally shared one.

Do You agree?
Logged
Gentoo i686

darksidex

  • Mule Farmer
  • Full Member
  • ***
  • Karma: 4
  • Offline Offline
  • Posts: 194
Re: Insterting file hash in the file's name
« Reply #1 on: December 10, 2005, 07:44:11 PM »

If you move a file and its hash changes, would you download it again? Because 'unmove' wont fix the hash.
If you burn a file into a dvd or cd and it has a wrong hash, would you throw it and re-burn a new cd or dvd?

Just curious.
Logged
First of all, I apologize for my bad english. :D

Arichy

  • Full Member
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 224
Re: Insterting file hash in the file's name
« Reply #2 on: December 10, 2005, 08:23:08 PM »

sure, what else?

I want an authentic and correct file. If it is not, i throw the dvd or the file away.

Maybe I want to share the file later, also.
Logged
Gentoo i686

Xaignar

  • Admin and Code Junky
  • Hero Member
  • *****
  • Karma: 19
  • Offline Offline
  • Posts: 1103
Re: Insterting file hash in the file's name
« Reply #3 on: December 10, 2005, 09:22:01 PM »

Why not just create a sha1 or md5 hashlist on the medium? Then you can use " --check " to check the files.
Logged

Arichy

  • Full Member
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 224
Re: Insterting file hash in the file's name
« Reply #4 on: December 11, 2005, 12:06:36 AM »

Quote
Originally posted by Xaignar
Why not just create a sha1 or md5 hashlist on the medium? Then you can use " --check " to check the files.

Because it's more complicated to deal with extra hash lists than having the hash being part of the file's own name?

Maybe that would be also good for detecting fakes online by their names (if the name's hash is not the file's hash, you can easily see that and use that as an advice, that there could be something incorrect) ?
Logged
Gentoo i686

Arichy

  • Full Member
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 224
Re: Insterting file hash in the file's name
« Reply #5 on: December 11, 2005, 12:11:35 AM »

then to files that are to be uploaded and do not have their hash in their name, the hash should also be added to the name (probably with the name of the hash algorithm before it).
Logged
Gentoo i686

Xaignar

  • Admin and Code Junky
  • Hero Member
  • *****
  • Karma: 19
  • Offline Offline
  • Posts: 1103
Re: Insterting file hash in the file's name
« Reply #6 on: December 11, 2005, 12:53:39 AM »

Dude, you are way too lazy. There's no point in us duplicating this functionality, and no, it offers no extra protection against fakes, it's the same as checking the file's hash via services like donkey-fakes, which still requires extra user-intervention.
Logged

Arichy

  • Full Member
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 224
Re: Insterting file hash in the file's name
« Reply #7 on: December 11, 2005, 01:22:21 AM »

I am lazy, otherwise I had no computer :D

I did not speak of protection, but of advisary.

If it's the same, then why do extra external checking and extra user-intervention.
Logged
Gentoo i686

Xaignar

  • Admin and Code Junky
  • Hero Member
  • *****
  • Karma: 19
  • Offline Offline
  • Posts: 1103
Re: Insterting file hash in the file's name
« Reply #8 on: December 11, 2005, 01:35:03 AM »

Actually, using a hash-list will probably be faster and doesn't give you yard-long filenames.

To create (assumes cwd is the contents to be placed on cd):
Code: [Select]
find -type f -exec sha1sum \{\} \; > hashlist.txt
To check (assumes cwd is the cd):
Code: [Select]
sha1sum --check hashlist.txt
As for fakechecks, simply having a hash in the file tells you nothing (except that there's a hash in the filename). You would have to look up the hash in a fakes-database in any case, which means that there is nothing gained compared to the current method of looking up the ed2k hash.
Logged

Kry

  • Ex-developer
  • Retired admin
  • Hero Member
  • *****
  • Karma: -665
  • Offline Offline
  • Posts: 5795
Re: Insterting file hash in the file's name
« Reply #9 on: December 11, 2005, 01:48:56 AM »

File would get shared with the new name, name would be longer, name is sent, network overload increases, AND it's annoying to see those stupid hashes.
Logged

Arichy

  • Full Member
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 224
Attached Python script for inserting file hash
« Reply #10 on: December 28, 2005, 11:14:58 AM »

I wrote a python script that does the hash inserting.

For people who might like it also and don't mind some extra bytes overhead for a slightly longer file name, it's attached.

The script inserts ".eD2k-" plus the first 9 hash chars before tha last occurence of a "." in the files name (e.g. "test-movie.avi" will be renamed to "test-movie.eD2k-123456789.avi"). If there is no "." in files name, hash will be added ("test-movie" -> "test-movie.eD2k-123456789")

To get it work, there must be python installed. (check "which python")

Rename insert-ed2k-hash.txt to insert-ed2k-hash.py

And in the command execution option in the files preferences (currently only available in CVS)there should stand something like
Code: [Select]
sh -c '~/bin/insert-ed2k-hash.py "%FILE" %HASH'to get it done automatically for every downloaded file (thanks for adding the command execution option to aMule).

I have used the script now for some weeks and I am very happy with it, because before I burn a CD image I want to check fast, if it's the originally downloaded, uncorrupted file, by hashing it and comparing the result with the first hash chars contained in the files name.

Hope You devs don't cut my head off now :D
Logged
Gentoo i686