| 61 | == C - Public Domain License== |
| 62 | {{{ |
| 63 | #!c |
| 64 | #include <stdio.h> |
| 65 | #include <stdlib.h> |
| 66 | |
| 67 | unsigned 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 | }; |
| 92 | int main(int argc, char *argv){ |
| 93 | unsigned long long myhash=analizefileOSHahs("C://tomaszkokowskizoofiliamovies.avi"); |
| 94 | printf("hash is %16I64x",myhash); |
| 95 | } |
| 96 | |
| 97 | }}} |