Changes between Version 40 and Version 41 of HashSourceCodes
- Timestamp:
- Feb 9, 2013, 3:18:22 PM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
HashSourceCodes
v40 v41 248 248 or without using GetHash.dll: 249 249 {{{ 250 #!c# 250 251 using System; 251 252 using System.Text; … … 315 316 == VB.Net == 316 317 {{{ 318 #!vba 317 319 Imports System 318 320 Imports System.Text … … 417 419 418 420 {{{ 421 #!delphi 419 422 function CalcGabestHash(const fname: string): string; 420 423 var … … 460 463 == Lua == 461 464 {{{ 465 #!lua 462 466 -- will produce a correct hash regardless of architecture (big vs little endian) 463 467 local function movieHash(fileName) … … 518 522 519 523 {{{ 524 #!realbasic 520 525 dim b as BinaryStream 521 526 dim mb as MemoryBlock … … 816 821 == Haskell == 817 822 {{{ 823 #!haskell 818 824 import IO(bracket) 819 825 import System.Environment(getArgs) … … 848 854 [http://www.autoitscript.com/forum/topic/107155-opensubtitles-org-hashing-func/page__p__755889__hl__opensubtitles__fromsearch__1#entry755889 Forum entry] 849 855 {{{ 856 #!autoit 850 857 #cs 851 858 Hash code is based on Media Player Classic. It calculates: size + 64bit … … 887 894 == !FoxPro == 888 895 {{{ 896 #!foxpro 889 897 PARAMETERS cfile 890 898 PRIVATE ALL … … 1124 1132 or without using GetHash.dll: 1125 1133 {{{ 1134 #!powershell 1126 1135 $dataLength = 65536 1127 1136 … … 1223 1232 '''OSHashAlgorithm.m''' 1224 1233 {{{ 1234 #!c++ 1225 1235 #import "OSHashAlgorithm.h" 1226 1236 … … 1306 1316 '''OSHashAlgorithm.h''' 1307 1317 {{{ 1318 #!c++ 1308 1319 #import <Cocoa/Cocoa.h> 1309 1320 … … 1378 1389 == !AutoHotKey == 1379 1390 {{{ 1391 #!autohotkey 1380 1392 #NoEnv 1381 1393 SetBatchLines, -1 … … 1426 1438 ; ================================================================================================== 1427 1439 }}} 1440 1441 == Lisp == 1442 {{{ 1443 #!lisp 1444 ; opensubtitle hash, common lisp, sbcl 1445 ; sean langton 2013 1446 1447 (defun get-lvalue(stream) 1448 (let ((c)(n 0)(m 1)) 1449 (loop for x from 0 to 7 do 1450 (setf c (read-byte stream)) 1451 (setf n (+ n (* c m))) 1452 (setf m (* m 256)) 1453 ) n)) 1454 1455 (defun hashfile(path) 1456 (let ((hash '(unsigned-byte 64))(len)) 1457 (with-open-file (in path :element-type '(unsigned-byte 8)) 1458 (setf len (file-length in)) 1459 (setf hash len) 1460 1461 (cond ((< len (* 2 65536)) 1462 (print "file too small to hash") 1463 (return-from hashfile nil))) 1464 1465 (loop for x from 0 to 8191 do 1466 (setf hash (logand (+ hash (get-lvalue in)) #xFFFFFFFFFFFFFFFF ))) 1467 1468 (file-position in (- len 65536)) 1469 1470 (loop for x from 0 to 8191 do 1471 (setf hash (logand (+ hash (get-lvalue in)) #xFFFFFFFFFFFFFFFF ))) 1472 1473 (format t "~&~16,'0x" hash)))) 1474 1475 ; (hashfile #p"~/Downloads/breakdance.avi") 1476 ; (hashfile #p"~/Downloads/dummy/dummy.bin") 1477 }}}