阿弥陀佛
android_zhang · 共 382 篇文章
android程序中证书签名校验的方法
android程序中证书签名校验的方法一 2013-02-26 09:56:22| 分类: android逆向技巧 |举报 |字号 订阅 (1)、将证书进行base64编码,并将编码后的字符串保存在程序中; (2)、将证书签名(MD5或SHA1值)进行对称算法加密(比如:DES),然后将加密后的结果和对称算法密钥放在一起,再使用证书的private key 对其加密,将加密后的结果保存在一个xxx.conf文件中; (3)、客户端启动时,通过解码(1)中的字符串得到证书的公钥,然后使用公钥解码xxx.conf文件,得到对称算法的key;然后使用key去解码被加密的签名字符串; (4)、客户端…
2014-04-28 17:58 · android · 评论(0)
Android 获取网络时间
Android 获取网络时间 在网上看到的最常见的方式有: public static void main(String args) throws Exception { URL url=new URL("http://www.bjtime.cn");//取得资源对象 URLConnection uc=url.openConnection();//生成连接对象 uc.connect(); //发出连接 long ld=uc.getDate(); //取得网站日期时间 Date date=new Date(ld); //转换为标准时间对象 //分别取得时间中的小时,分钟和秒,并输出 Syste…
2014-03-12 11:42 · android · 评论(0)
SQLite清空表并将自增列归零
SQLite清空表并将自增列归零 作者:Zhu Yanfeng 发布:2012-09-29 14:43 分类:数据库 阅读:3,567次 抢沙发 SQL标准中有TRUNCATE TABLE语句,用来清空表的所有内容。但SQLite不支持这个语句。在SQLite中直接使用“DELETE FROM TableName”就可以了。对于大多数DBMS来说,用DELETE不如用TRUNCATE 速度快,因为TRUNCATE 不用访问整个表,不用记录数据的变动。 SQLite虽然不支持TRUNCATE,但它对DELETE做了优化:“When the WHERE is omitted(略去) from a…
2014-03-05 18:02 · android · 评论(0)
从0学习C++ (九) 构造函数
#include <iostream>; using namespace std; /* 类继承中的构造函数 当Animal的构造函数变为Animal(int height,int weight)时,系统并不会为Animal生成默认构造函数。 这个时候 Fish类的构造函数要变为:Fish(): Animal(100,200) --》其中的100 200为传入的参数。 Fish类可以在构造的时候为常量 a 赋值。 Fish(): Animal(100,200),a(1) 其中1是给常量赋的值 ~Animal(){} 析构函数。 释放对象。 */ class Animal { public: …
2014-01-07 17:03 · C++ · 评论(0)
从0学习C++ (八) 继承
#include <iostream>; using namespace std; /* 类的继承 */ class Animal { public: Animal() { cout << "Animal construct" << endl; } ~Animal() { cout << "Animal deconstruct" << endl; } void eat() { cout << "Animal eat" << endl; } protected : void sleep() { cout << "Animal sleep" << endl; } private : void b…
2014-01-07 15:28 · C++ · 评论(0)
从0学习C++ (七) 结构体 与 类
#include <iostream>; using namespace std; //结构体.结构体中默认的访问权限是public struct People { int a; int b; void output() { a = 1000; b = 2000; cout << a << endl << b << endl; } }; //类.类中的变量或函数的访问权限默认是private。 class Point { public : int x; int y; //无参构造函数 Point() { x = 1; y = 2; } //带两个参数的构造函数 Point(int a,int…
2014-01-07 15:27 · C++ · 评论(0)
从0学习C++ (六)枚举
#include <iostream>; #include <cmath>; #include <string>; #include <cstring>; /* 枚举学习 */ enum spectrum{red,orange,yellow,green,blue,violet,indigo,ultraviolet}; enum bits{one = 1, two = 2,four = 4,eight = 8}; enum bigstep{first,second = 100,third}; //只是用常量,而不创建枚举类型的变量 enum {zero,null = 0,love,numero…
2014-01-07 15:26 · C++ · 评论(0)
从0学习C++ (五)匿名共同体
#include <iostream>; #include <cmath>; #include <string>; #include <cstring>; /* 匿名共用体 匿名共用体(anonymous union)没有名称,其成员将成为位于相同地质处的变量。显然,每次 只有一个成员是当前的成员。 下面的例子中,由于共同体是匿名的,因此id_num 和 id_char被视为price的两个成员,他们的地址相同,所以 不需要中间标示符 id_val.程序员负责确定当前哪个成员是活动的。 */ struct widget{ char brand[20]; int type; union { l…
2014-01-07 14:42 · C++ · 评论(0)
从0学习C++ (四) cin读取一行输入
#include <iostream>; #include <cmath>; #include <string>; #include <cstring>; /* cin读取一行数据,获取正行输入。 char[] 与 string的区别。 */ int main(){ using namespace std; char mchar[20]; string str; cout << "mchar strlen = " << strlen(mchar) << endl; cout << "str size = " << str.size() << endl; cout << "enter for …
2014-01-02 17:50 · C++ · 评论(0)
从0学习C++ (三) 结构体中包含共同体
#include <iostream>; #include <cmath>; #include <string>; #include <cstring>; /* 结构体中包含共用体 举例:管理一个商品小目录,其中有一些商品的ID是整数,而另一些的ID是字符串。 在这种情况下,可以这样做: */ struct widget{ char brand[20]; int type; union id{ long id_num; char id_char[20]; }id_val; }; int main(){ using namespace std; widget price; price.type…
2014-01-02 17:48 · C++ · 评论(0)
从0学习C++ (二) 共同体
#include <iostream>; #include <cmath>; #include <string>; #include <cstring>; /* 共用体(union)是一种数据格式,它能够存储不同的数据类型,但同时只能存储其中的一种类型, 共用体的长度为其最大成员的长度。 共用体的用途:当数据项使用两种或更多格式(但不会同时使用时) */ union one4all{ int int_val; long long_val; double double_val; }; int main(){ using namespace std; one4all pail; pail.int…
2014-01-02 17:46 · C++ · 评论(0)
从0学习C++ (一) 结构体
#include <iostream>; #include <cmath>; #include <string>; #include <cstring>; //定义常量 注:没有类型,后面没有 ; #define RESULT_MAX 888 void toast(int number); int add(int a,int b); /* 定义结构体 包括三个结构成员。 注:每个成员之后都有一个 ; 注:{}后面还有一个 ; */ struct inflater{ char name[20]; float volume; double price; }; int main(){ using …
2014-01-02 17:45 · C++ · 评论(0)
Unity3d的GUI排版教程
学习一下:Unity3d的GUI排版教程 GUILayout.BeginArea、GUILayout.BeginVertical、GUILayout.BeginHorizontal这三大要素,下面我讲用这三大要素来进行一次经典的横、纵、横式布局排版,布局格式如下图所示: 接着代码如下所示: GUILayout.BeginArea(new Rect(10, 10, 300, 300)); GUILayout.Button("A"); GUILayout.BeginHorizontal("", GUILayout.Width(290)); GUILayout.BeginVertical("",G…
2014-01-02 17:42 · Unity3d · 评论(0)
Unity3D研究之打开Activity与调用Java代码传递参数
Unity for Android 比较特殊,Unity for IOS 打包是将XCODE工程直接交给开发者,开发者可以在工程的基础上继续添加新的视图,最后由开发者自行打包生成IPA包,发布程序。而Unity for Android打包直接生成APK包,等于说源代码开发者是看不到的,但是Unity的自身确实有些局限,针对Android平台我们需要学习如何在 Unity中调用Android的JAVA代码。本章我们的目标是使用Unity的脚本打开Activity。首先我们创建一个普通的Android工程,目录结构如下图所示。 因为项目需要使用Unity提供的接口,所以需要将接口classes.…
2013-12-31 16:45 · Unity3d · 评论(0)
Unity3D调用Android接口
简介 有一些手机功能,Unity没有提供相应的接口,例如震动,例如不锁屏,例如GPS,例如... 有太多的特殊功能Unity都没有提供接口,这时候,我们就需要通过使用Android原生的ADT编辑器去编写Java代码,然后打包jar导入到Unity工程,然后通过Unity提供的调用Android接口的函数去调用jar包中的函数即可。 这里我们就介绍一下使用Unity实现手机震动效果 实现内容简要说明: Android提供jar文件,xml文件,res目录,libs目录 通过AndroidJavaClass去调用Android函数 另外,这些功能只能在真机上运行! 具体实现: Android部…
2013-12-31 16:25 · Unity3d · 评论(0)