yum install libuuid-devel
/**
* gcc -o uuid uuid.c -luuid
*/
echo 1 > /proc/sys/vm/overcommit_memory | |
echo never > /sys/kernel/mm/transparent_hugepage/enabled |
//java | |
static int tableSizeFor(int cap) { | |
int n = cap - 1; | |
n |= n >>> 1; | |
n |= n >>> 2; | |
n |= n >>> 4; | |
n |= n >>> 8; | |
n |= n >>> 16; | |
return (n < 0) ? 1 : n + 1; | |
} |
static char * string_trim (char *s) { | |
char *p; | |
/* skip leading white spaces */ | |
while (*s && isspace (*s)) | |
++s; | |
/* trim trailing white spaces */ | |
p = s + strlen (s) - 1; | |
while (isspace (*p)) |
NSString *string = @"我123"; | |
const char *inStr = [string UTF8String]; | |
unsigned char result[MD5_DIGEST_LENGTH]; | |
NSMutableString *outStr = [NSMutableString string]; | |
MD5((unsigned char *)inStr, strlen(inStr), result); | |
unsigned int i; | |
for (i = 0; i < MD5_DIGEST_LENGTH; i++){ | |
[outStr appendFormat:@"%02x", result[i]]; | |
} | |
NSLog(@"input string:%@" ,string); |
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <openssl/aes.h> | |
int main(int argc, char** argv) { | |
AES_KEY aes; | |
unsigned char key[AES_BLOCK_SIZE]; // AES_BLOCK_SIZE = 16 | |
unsigned char iv[AES_BLOCK_SIZE]; // init vector | |
unsigned char* input_string; |
yum install libuuid-devel
/**
* gcc -o uuid uuid.c -luuid
*/
//
//gcc -std=c99 crypto.m -framework Foundation
//
//
#import <Foundation/Foundation.h>
#import <CommonCrypto/CommonCryptor.h>
NSData+Zlib.h
#import @interface NSData (Zlib) - (id)deflate:(int)compressionLevel; - (id)inflate; @end
#import <CommonCrypto/CommonDigest.h>
NSString *md5_str = @"1234567890";
const char *cStr = [md5_str UTF8String];
unsigned char digest[CC_MD5_DIGEST_LENGTH];
CC_MD5(cStr, (CC_LONG)strlen(cStr), digest);
NSMutableString *output = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2];
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <unistd.h>
int main(int argc, char **argv) {