# OpenSSL MD5 String



## Syphor (Aug 27, 2002)

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:


```
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?


----------



## ladavacm (Aug 28, 2002)

man 3 md5

man 3 evp
man 3 EVP_DigestInit


----------



## rharder (Sep 3, 2002)

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


----------

