support for sha1 file-hashes

This commit is contained in:
Arvid Norberg
2010-03-27 15:51:30 +00:00
parent c6f57ce5d7
commit b4abe6677d
9 changed files with 120 additions and 4 deletions

View File

@@ -119,13 +119,15 @@ int main(int argc, char* argv[])
{
int first = t.map_file(index, 0, 0).piece;
int last = t.map_file(index, (std::max)(i->size-1, size_type(0)), 0).piece;
printf(" %11"PRId64" %c%c%c%c [ %4d, %4d ] %s %s%s\n"
printf(" %11"PRId64" %c%c%c%c [ %4d, %4d ] %s %s %s%s\n"
, i->size
, (i->pad_file?'p':'-')
, (i->executable_attribute?'x':'-')
, (i->hidden_attribute?'h':'-')
, (i->symlink_attribute?'l':'-')
, first, last, i->path.c_str()
, first, last
, i->filehash ? to_hex(i->filehash->to_string()).c_str() : ""
, i->path.c_str()
, i->symlink_attribute ? "-> ": ""
, i->symlink_attribute ? i->symlink_path.c_str() : "");
}

View File

@@ -66,6 +66,9 @@ void print_usage()
"OPTIONS:\n"
"-m generate a merkle hash tree torrent.\n"
" merkle torrents require client support\n"
"-f include sha-1 file hashes in the torrent\n"
" this helps supporting mixing sources from\n"
" other networks\n"
"-w url adds a web seed to the torrent with\n"
" the specified url\n"
"-t url adds the specified tracker to the\n"
@@ -144,6 +147,9 @@ int main(int argc, char* argv[])
++i;
outfile = argv[i];
break;
case 'f':
flags |= create_torrent::calculate_file_hashes;
break;
default:
print_usage();
return 1;