Changes between Version 11 and Version 12 of HashSourceCodes


Ignore:
Timestamp:
Apr 19, 2009, 7:09:29 PM (16 years ago)
Author:
guest
Comment:

C - Public Domain License

Legend:

Unmodified
Added
Removed
Modified
  • HashSourceCodes

    v11 v12  
    5959}}}
    6060
     61== C - Public Domain License==
     62{{{
     63#!c
     64#include <stdio.h>
     65#include <stdlib.h>
     66
     67unsigned long long analizefileOSHahs(char *fileName){
     68 /*
     69  * Public Domain implementation by Kamil Dziobek. turbos11(at)gmail.com
     70  * This code implements Gibest hash algorithm first use in Media Player Classics
     71  * For more implementation(various languages and authors) see:
     72  * http://trac.opensubtitles.org/projects/opensubtitles/wiki/HashSourceCodes   
     73  *
     74  * -works only on little-endian procesor DEC, Intel and compatible
     75  * -sizeof(unsigned long long) must be 8
     76  */
     77 
     78  FILE        *file;
     79  int i;
     80  unsigned long long t1=0;
     81  unsigned long long buffer1[8192*2];
     82  file = fopen(fileName, "rb");
     83  fread(buffer1, 8192, 8, file);
     84  fseek(file, -65536, SEEK_END);
     85  fread(&buffer1[8192], 8192, 8, file);
     86  for (i=0;i<8192*2;i++)
     87    t1+=buffer1[i];
     88  t1+= ftell(file); //add filesize
     89  fclose(file);
     90  return  t1;
     91};
     92int main(int argc, char *argv){
     93  unsigned long long myhash=analizefileOSHahs("C://tomaszkokowskizoofiliamovies.avi");
     94  printf("hash is %16I64x",myhash);
     95}
     96
     97}}}
    6198
    6299== C++ ==
     
    111148
    112149}}}
     150
     151==About C and C++ implementation==
     152This only work on little-endian processor: DEC, Intel and compatible
     153
    113154
    114155
     
    435476          hash = hash+ mb.UINT64Value(i)
    436477        next
     478
    437479       
    438480        myhash = Lowercase(str(hex(hash)))