OpenSSL MD5 String

Syphor

Registered
Is there a way using openssl to get the md5 hash from a string instead of a file... this is what I use now...

Code:

Code:
NSTask *bam = [[NSTask alloc] init];
    
    [bam setLaunchPath:@"/usr/bin/env"];
    [bam setArguments:
        [NSArray arrayWithObjects:@"openssl", @"dgst", @"-md5", @"/Users/syphor/Desktop/password.txt", nil]
    ];
    [bam launch];
Is there any other way of doing this with a string instead of a file?
 

rharder

Do not read this sign.
You could also perhaps use an NSPipe to pipe the data into the NSTask. Then openssl would think it's just taking Standard Input, but in fact you would be feeding the NSPipe data manually.

-Rob
 
Top