ANDROID
doorxp
演译至上经典,静候不凡目光
展开
-
在linux下获取本机MAC地址的函数
int sock_mac; struct ifreq ifr_mac; char mac_addr[30]; sock_mac = socket( AF_INET, SOCK_STREAM, 0 ); if( sock_mac == -1) { perror("create socket falise...mac\n"); return ""; }原创 2013-03-07 15:09:03 · 713 阅读 · 0 评论 -
android des 加密解密
/** 加密 */ public byte[] enDES(byte[] datasource, String password) { byte[] data = null; try { Log.e("Haj", "data:"+datasource.length+" password:" + password.length()); SecretKeySpec key = n原创 2014-01-13 14:17:06 · 926 阅读 · 1 评论 -
ios 计算utf8 的字符个数.
支持所有语言的utf8编码的字符串.汇编: 时间效率//// LenUTF8.s// TestASM//// Created by doorxp on 7/5/13.// Copyright (c) 2013 doorxp. All rights reserved.////extern int lenutf(const char *src, bool noAs原创 2013-07-05 13:44:02 · 1151 阅读 · 0 评论 -
JNI 调用 java.lang.String的substring方法
string subStr(const string& m, size_t to){ string retStr = ""; JniMethodInfo minfo; if(JniHelper::getMethodInfo(minfo,"java/lang/String","substring","(II)Ljava/lang/String;")) //此处的分号原创 2013-03-22 17:49:25 · 1276 阅读 · 0 评论 -
自定义的高效加密解密算法
相同的key每一次加密的密文都不一样.难于破解.整个密文相关.修改其中一段后,以后的数据解密不正确typedef unsigned int Unit;std::string encrypt(const std::string &src,Unit key){ Unit seed = 0; const size_t unitlen = sizeof(Unit);原创 2013-04-05 23:56:29 · 4169 阅读 · 0 评论 -
3DES 返回数据不对
size_t 返回数据字节长度 = (数据字节长度 + kCCBlockSize3DES-1) & ~(kCCBlockSize3DES - 1);des求返回数据长度,就是求比原数据长度大的最小的8的倍数的数注意红色部分,否则解出的数据后面会多几个字节的数据,内容不定原创 2013-04-01 18:10:41 · 495 阅读 · 0 评论 -
get ip address & mac address
#include #include #include #include #include #include #include #include #include #include #include #include #include #include //#include "GetAddresses.h" #define min(a转载 2013-03-09 00:04:34 · 777 阅读 · 0 评论 -
eclipse console 中文乱码
建置全UTF-8的環境:1.在eclipse.ini的-vmargs下面加上「-Dfile.encoding=UTF-8」。2.eclipse-->Window-->Preferences-->General-->Workspace-->Text file encoding-->UTF-83.Installed JREs-->Default VM Arguments:-->-Dfile转载 2013-03-08 19:22:03 · 1364 阅读 · 0 评论 -
Android — get MEID
NDKJNIEnv *env;jobject context;/* then call (with error-checking) */jclass cls = (*env)->FindClass(env, "android/context/Context");jmethodId mid = (*env)->GetMethodID(env, context_cls, "getSys原创 2013-03-07 16:45:15 · 1599 阅读 · 0 评论 -
android 自动加所有cpp文件
ALLFILES = $(call walk, $(LOCAL_PATH)/../../Classes) FILE_LIST := hellocpp/main.cppFILE_LIST += $(filter %.cpp, $(ALLFILES)) LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%)LOCAL_C_IN转载 2014-02-08 16:27:22 · 580 阅读 · 0 评论