📄 smscryptosymbiancppuicrypter.c
字号:
/*
* ============================================================================
* Name : SMSCryptoSymbianCppUICrypter.c
* Part of : Open C SMS Crypto Example
* Created : 05/25/2007 by Forum Nokia
* Version : 1.0
* Copyright: Nokia Corporation
* ============================================================================
*/
#include "SMSCryptoSymbianCppUICrypter.h"
#include <stddef.h>
#include <openssl/rc4.h>
#include <openssl/md5.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* Encrypt a SMS message using Open C libcrypt
*/
void s60_encrypt(int len, unsigned char* in, unsigned char* crypted, unsigned char* password, int passlen)
{
unsigned char digest[MD5_DIGEST_LENGTH];
RC4_KEY key;
MD5(password, passlen, digest);
RC4_set_key(&key, MD5_DIGEST_LENGTH, digest);
RC4(&key, len, in, crypted);
}
/**
* Decrypt a SMS message using Open C libcrypt
*/
void s60_decrypt(int len, unsigned char* in, unsigned char* decrypted, unsigned char* password, int passlen)
{
unsigned char digest[MD5_DIGEST_LENGTH];
RC4_KEY key;
MD5(password, passlen, digest);
RC4_set_key(&key, MD5_DIGEST_LENGTH, digest);
RC4(&key, len, in, decrypted);
}
#ifdef __cplusplus
}
#endif
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -