mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-11-21 15:02:40 +00:00
See ChangeLog
Monotone-Parent: 747fe8c2134a990c1cdf3b494c2b7776021cb736 Monotone-Revision: 3c4baa92c5634d4da061da739a9b544d04c44586 Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2012-05-31T13:24:32
This commit is contained in:
1 parent
18ffca1924
commit
08230b33bb
12 files changed
+1092
-118
No files matched your search
@@ -21,10 +21,6 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __OpenBSD__
|
||||
#include <crypt.h>
|
||||
#endif
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSCharacterSet.h>
|
||||
#import <Foundation/NSData.h>
|
||||
@@ -45,12 +41,6 @@
|
||||
|
||||
#import "NSString+Utilities.h"
|
||||
|
||||
#define _XOPEN_SOURCE 1
|
||||
#include <unistd.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/md5.h>
|
||||
#include <openssl/sha.h>
|
||||
|
||||
static NSMutableCharacterSet *urlNonEndingChars = nil;
|
||||
static NSMutableCharacterSet *urlAfterEndingChars = nil;
|
||||
static NSMutableCharacterSet *urlStartChars = nil;
|
||||
@@ -535,48 +525,6 @@ static int cssEscapingCount;
|
||||
return object;
|
||||
}
|
||||
|
||||
- (NSString *) asCryptStringUsingSalt: (NSString *) theSalt
|
||||
{
|
||||
char *buf;
|
||||
|
||||
// The salt is weak here, but who cares anyway, crypt should not
|
||||
// be used anymore
|
||||
buf = crypt([self UTF8String], [theSalt UTF8String]);
|
||||
return [NSString stringWithUTF8String: buf];
|
||||
}
|
||||
|
||||
- (NSString *) asMD5String
|
||||
{
|
||||
unsigned char md[MD5_DIGEST_LENGTH];
|
||||
char buf[80];
|
||||
int i;
|
||||
|
||||
memset(md, 0, MD5_DIGEST_LENGTH);
|
||||
memset(buf, 0, 80);
|
||||
|
||||
EVP_Digest((const void *) [self UTF8String], strlen([self UTF8String]), md, NULL, EVP_md5(), NULL);
|
||||
for (i = 0; i < MD5_DIGEST_LENGTH; i++)
|
||||
sprintf(&(buf[i*2]), "%02x", md[i]);
|
||||
|
||||
return [NSString stringWithUTF8String: buf];
|
||||
}
|
||||
|
||||
- (NSString *) asSHA1String
|
||||
{
|
||||
unsigned char sha[SHA_DIGEST_LENGTH];
|
||||
char buf[80];
|
||||
int i;
|
||||
|
||||
memset(sha, 0, SHA_DIGEST_LENGTH);
|
||||
memset(buf, 0, 80);
|
||||
|
||||
SHA1((const void *)[self UTF8String], strlen([self UTF8String]), sha);
|
||||
for (i = 0; i < SHA_DIGEST_LENGTH; i++)
|
||||
sprintf(&(buf[i*2]), "%02x", sha[i]);
|
||||
|
||||
return [NSString stringWithUTF8String: buf];
|
||||
}
|
||||
|
||||
- (NSString *) asSafeSQLString
|
||||
{
|
||||
return [[self stringByReplacingString: @"\\" withString: @"\\\\"]
|
||||
|
||||
Reference in new issue
Block a user