41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
OFFile *f = [OFFile fileWithPath: @"testfile.bin"
mode: @"rb"];
TEST(@"+[SHA1Hash]", (sha1 = [OFSHA1Hash SHA1Hash]))
while (![f isAtEndOfStream]) {
char buf[64];
size_t len = [f readNBytes: 64
intoBuffer: buf];
[sha1 updateWithBuffer: buf
length: len];
}
[f close];
TEST(@"-[digest]",
!memcmp([sha1 digest], testfile_sha1, OF_SHA1_DIGEST_SIZE))
|
|
|
|
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
OFFile *f = [OFFile fileWithPath: @"testfile.bin"
mode: @"rb"];
TEST(@"+[SHA1Hash]", (sha1 = [OFSHA1Hash SHA1Hash]))
while (![f isAtEndOfStream]) {
char buf[64];
size_t len = [f readIntoBuffer: buf
length: 64];
[sha1 updateWithBuffer: buf
length: len];
}
[f close];
TEST(@"-[digest]",
!memcmp([sha1 digest], testfile_sha1, OF_SHA1_DIGEST_SIZE))
|