Commits

Dominik Engelke committed f5a1aa7

Changed from NSTask/openssl to CommonDigest

Comments (0)

Files changed (2)

 //
 
 #import "HashController.h"
-//#include <openssl/md5.h>
+#include <CommonCrypto/CommonDigest.h>
 
 @implementation HashController
 
 - (void)generateHash {
 	NSLog(@"generate hash with file: %@", filePath);
 	[progress startAnimation:self];
+	
+	unsigned char md5[16];
+	
+	NSData* data = [NSData dataWithContentsOfFile:filePath];
+	CC_MD5([data bytes], [data length], md5);
+	NSString *outString = [NSString stringWithFormat:@"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",md5[0],md5[1],md5[2],md5[3],md5[4],md5[5],md5[6],md5[7],md5[8],md5[9],md5[10],md5[11],md5[12],md5[13],md5[14],md5[15]];
+	NSLog(@"hash: %@", outString);
+	[hashTextField setStringValue:outString];
+	/*
 	NSData *data;
 	NSTask *task = [[NSTask alloc] init];
 	NSPipe *pipe = [[NSPipe alloc] init];
 	}
 	
 	[task waitUntilExit];
+	*/
+	
 //	NSLog(@"Data: %@", data);
 //	NSString *outString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
 	[progress stopAnimation:self];
+	
+	/*
 	[pipe release];
 	[task release];
+	 */
 }
 
 - (unsigned int)draggingEntered:(id <NSDraggingInfo>)sender
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleVersion</key>
-	<string>5</string>
+	<string>6</string>
 	<key>CFBundleShortVersionString</key>
 	<string>1.0</string>
 	<key>NSMainNibFile</key>