Commitment:
1. Hide
2. Binding
Verifiable Computation:
使用者用以確定Server運算是否正確
Authentication Computation
Server用來驗證使用者或使用者提出資料是否正確
自己的小練習, 如有侵權, 被我不小心引用沒標名出處或是不想被我標示出來, 趕快跟我講, 有時候一忙會忘記看這個, 有問題或是有更好的辦法更要跟我講, 如果有什麼覺得可以更積極的, 也希望可以小力的酸我, 我玻璃心阿
總網頁瀏覽量
2016年2月25日 星期四
2016年2月18日 星期四
[Java] javap 觀察看看
A.1 Examining Java Classfiles
已知Java會先編譯成class檔,
也就是Source Code編譯成Byte Code。
但是要看到Byte Code內的情況一般都會略過不談,
所以現在要用到只好很雞八的來看一下了。
而一般Java的JDC工具包內其實就已經有個工具可以用了,也就是 Javap。
javap -help
Usage: javap <options> <classes>
where possible options include:
-help 顯示常用指令資訊
-version 顯示目前所用JDK版本編號
-verbose / -v [檔名] 顯示[檔名]的所以class檔資訊
-l 顯示 line number 和 local variable tables 資訊
-public 顯示 public classes 和 members (其他皆不列出)
-protected 顯示 protected/public classes 和 members
-package 顯示 package/protected/public classes 和 members (default)
-p -private 顯示 Show all classes and members
-c 打開 class看ByteCode( Disassemble the code)
-s Print internal type signatures
-sysinfo Show system info of class being processed
-constants Show final constants
-classpath <path> Specify where to find user class files
-cp <path> Specify where to find user class files
-bootclasspath <path> Override location of bootstrap class files
-------------------------------------------------------------------------------------------------------------
public class A {
public static void main(String[] args){
int a = 9;
String c = "123";
}
public void move(int a){}
public boolean move2(){ return true;}
}
-------------------------------------------------------------------------------------------------------------
-v A
Classfile /C:/Users/haha/Desktop/New folder/A.classLast modified 2016/2/19; size 377 bytes
MD5 checksum 47008851a8f4aad1f298978ae5976262
Compiled from "A.java"
public class A
minor version: 0
major version: 52
flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
#1 = Methodref #4.#17 // java/lang/Object."<init>":()V
#2 = String #18 // 123
#3 = Class #19 // A
#4 = Class #20 // java/lang/Object
#5 = Utf8 <init>
#6 = Utf8 ()V
#7 = Utf8 Code
#8 = Utf8 LineNumberTable
#9 = Utf8 main
#10 = Utf8 ([Ljava/lang/String;)V
#11 = Utf8 move
#12 = Utf8 (I)V
#13 = Utf8 move2
#14 = Utf8 ()Z
#15 = Utf8 SourceFile
#16 = Utf8 A.java
#17 = NameAndType #5:#6 // "<init>":()V
#18 = Utf8 123
#19 = Utf8 A
#20 = Utf8 java/lang/Object
{
public A();
descriptor: ()V
flags: ACC_PUBLIC
Code:
stack=1, locals=1, args_size=1
0: aload_0
1: invokespecial #1 // Method java/lang/Object."<init>":()V
4: return
LineNumberTable:
line 1: 0
public static void main(java.lang.String[]);
descriptor: ([Ljava/lang/String;)V
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=1, locals=3, args_size=1
0: bipush 9
2: istore_1
3: ldc #2 // String 123
5: astore_2
6: return
LineNumberTable:
line 3: 0
line 4: 3
line 5: 6
public void move(int);
descriptor: (I)V
flags: ACC_PUBLIC
Code:
stack=0, locals=2, args_size=2
0: return
LineNumberTable:
line 7: 0
public boolean move2();
descriptor: ()Z
flags: ACC_PUBLIC
Code:
stack=1, locals=1, args_size=1
0: iconst_1
1: ireturn
LineNumberTable:
line 9: 0
}
SourceFile: "A.java"
-------------------------------------------------------------------------------------------------------------
-l A
Compiled from "A.java"public class A {
public A();
LineNumberTable:
line 1: 0
public static void main(java.lang.String[]);
LineNumberTable:
line 3: 0
line 4: 3
line 5: 6
public void move(int);
LineNumberTable:
line 7: 0
public boolean move2();
LineNumberTable:
line 9: 0
}
-------------------------------------------------------------------------------------------------------------
-public A
Compiled from "A.java"
public class A {
public A();
public static void main(java.lang.String[]);
public void move(int);
public boolean move2();
}
-------------------------------------------------------------------------------------------------------------
把 public void move(int); 改成 private void move(int);
-p A
Compiled from "A.java"
public class A {
public A();
public static void main(java.lang.String[]);
private void move(int);
public boolean move2();
}
-------------------------------------------------------------------------------------------------------------
-c A
Compiled from "A.java"
public class A {
public A();
Code:
0: aload_0
1: invokespecial #1 // Method java/lang/Object."<init>":()V
4: return
public static void main(java.lang.String[]);
Code:
0: bipush 9
2: istore_1
3: ldc #2 // String 123
5: astore_2
6: return
public boolean move2();
Code:
0: iconst_1
1: ireturn
}
-------------------------------------------------------------------------------------------------------------
-s A
Compiled from "A.java"
public class A {
public A();
descriptor: ()V
public static void main(java.lang.String[]);
descriptor: ([Ljava/lang/String;)V
public boolean move2();
descriptor: ()Z
}
-------------------------------------------------------------------------------------------------------------
-sysinfo A
Classfile /C:/Users/haha/Desktop/New folder/A.class
Last modified 2016/2/19; size 377 bytes
MD5 checksum eaf868990ea17c4dd4ee7691a79c7cba
Compiled from "A.java"
public class A {
public A();
public static void main(java.lang.String[]);
public boolean move2();
}
2016年2月14日 星期日
ByteCod test ByteCodetest001
JAVA 是一個 type-safe language, 他的 field, local Variable, 和methods都會除存,
這稱呼為 Signatures.
而字串則會儲存在 constant pool中.
以下範例兩行敘述跟maia方法的回傳:
ByteCodetest001.java
class ByteCodetest001{
public static void main(String args[]){
}
}
用jd-gui-windows-1.4.0 的 Java Decompiler做反組譯:
ByteCodetest001.class
class ByteCodetest001
{
public static void main(String[] paramArrayOfString) {}
}
用Sandmark 的 View JarFile 功能來看 ByteCodetest001.class ,
他的 Signatures, 也就是位於 [View] 中的 Method Sort 所顯示的像目,
會看到
ByteCode001
- <init>()V
- main([Ljava/lang/String;)V
Classes are internally represented by strings like "java/lang/string"
由文中敘述他將此稱為 Class 類,
兩行敘述比對一下
class ByteCodetest001{ | <init>()V
public static void main(String args[]){ | main([Ljava/lang/String;)V
main([Ljava/lang/String;)V
main 表示此敘述為 main method
main([ 表示這是一個一為陣列 Arrays are denoted with a [ at the start of the signature.
main([L 表示 fully-qualified-class
main([Ljava/lang/String;) 我看來是main mothed 的輸入參數是一個string,
而String 是一個位於lang類別抵下的參數, 就全不顯示上來了.
main([Ljava/lang/String;)V我看來是 is a void method on
javap ByteCodetest001 查看 bytecode
javap ByteCodetest001
Compiled from "ByteCodetest001.java"
class ByteCodetest001 {
ByteCodetest001();
public static void main(java.lang.String[]);
}
存成 bc檔
-c ByteCodetest001 > ByteCodetest001.bc
Compiled from "ByteCodetest001.java"
class ByteCodetest001 {
ByteCodetest001();
Code:
0: aload_0
1: invokespecial #1 // Method java/lang/Object."<init>":()V
4: return
public static void main(java.lang.String[]);
Code:
0: return
}
這稱呼為 Signatures.
而字串則會儲存在 constant pool中.
以下範例兩行敘述跟maia方法的回傳:
ByteCodetest001.java
class ByteCodetest001{
public static void main(String args[]){
}
}
用jd-gui-windows-1.4.0 的 Java Decompiler做反組譯:
ByteCodetest001.class
class ByteCodetest001
{
public static void main(String[] paramArrayOfString) {}
}
用Sandmark 的 View JarFile 功能來看 ByteCodetest001.class ,
他的 Signatures, 也就是位於 [View] 中的 Method Sort 所顯示的像目,
會看到
ByteCode001
- <init>()V
- main([Ljava/lang/String;)V
Classes are internally represented by strings like "java/lang/string"
由文中敘述他將此稱為 Class 類,
兩行敘述比對一下
class ByteCodetest001{ | <init>()V
public static void main(String args[]){ | main([Ljava/lang/String;)V
main([Ljava/lang/String;)V
main 表示此敘述為 main method
main([ 表示這是一個一為陣列 Arrays are denoted with a [ at the start of the signature.
main([L 表示 fully-qualified-class
main([Ljava/lang/String;) 我看來是main mothed 的輸入參數是一個string,
而String 是一個位於lang類別抵下的參數, 就全不顯示上來了.
main([Ljava/lang/String;)V我看來是 is a void method on
java.lang.Object
.javap ByteCodetest001 查看 bytecode
javap ByteCodetest001
Compiled from "ByteCodetest001.java"
class ByteCodetest001 {
ByteCodetest001();
public static void main(java.lang.String[]);
}
存成 bc檔
-c ByteCodetest001 > ByteCodetest001.bc
Compiled from "ByteCodetest001.java"
class ByteCodetest001 {
ByteCodetest001();
Code:
0: aload_0
1: invokespecial #1 // Method java/lang/Object."<init>":()V
4: return
public static void main(java.lang.String[]);
Code:
0: return
}
2016年2月3日 星期三
在 Unbuntu 安裝 java 1.4
關網 http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase14-419411.html
Java SE Development Kit 1.4.2_18
Java SE Development Kit 1.4.2_18 (34.69 MB) j2sdk-1_4_2_18-linux-i586.bin
之後安裝完後, 其實還會有問題.
因為是用 共用文件傳資料的, 所以路徑會比較不同
root@liu-VirtualBox:/media/sf_share_data/j2sdk1.4.2_18/bin# java
The program 'java' can be found in the following packages:
* default-jre
* gcj-4.8-jre-headless
* openjdk-7-jre-headless
* gcj-4.6-jre-headless
* openjdk-6-jre-headless
Try: apt-get install <selected package>
依序執行指令, 就好了
root@liu-VirtualBox:/media/sf_share_data/j2sdk1.4.2_18/bin# sudo apt-get install defailt-jre
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package defailt-jre
root@liu-VirtualBox:/media/sf_share_data# sudo apt-get install default
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package default
root@liu-VirtualBox:/media/sf_share_data#
root@liu-VirtualBox:/media/sf_share_data# sudo apt-get install openjdk-7-jre
DONE
而刪除文件也要下載套件
remove data instance and process :
root@liu-VirtualBox:/media# redir test
The program 'redir' is currently not installed. You can install it by typing:
apt-get install redir
root@liu-VirtualBox:/media# sudo apt-get install redir
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
redir
0 upgraded, 1 newly installed, 0 to remove and 258 not upgraded.
Need to get 18.6 kB of archives.
After this operation, 71.7 kB of additional disk space will be used.
Get:1 http://tw.archive.ubuntu.com/ubuntu/ trusty/universe redir i386 2.2.1-11 [18.6 kB]
Fetched 18.6 kB in 0s (20.4 kB/s)
Selecting previously unselected package redir.
(Reading database ... 165089 files and directories currently installed.)
Preparing to unpack .../redir_2.2.1-11_i386.deb ...
Unpacking redir (2.2.1-11) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up redir (2.2.1-11) ...
Java SE Development Kit 1.4.2_18
Java SE Development Kit 1.4.2_18 (34.69 MB) j2sdk-1_4_2_18-linux-i586.bin
之後安裝完後, 其實還會有問題.
因為是用 共用文件傳資料的, 所以路徑會比較不同
root@liu-VirtualBox:/media/sf_share_data/j2sdk1.4.2_18/bin# java
The program 'java' can be found in the following packages:
* default-jre
* gcj-4.8-jre-headless
* openjdk-7-jre-headless
* gcj-4.6-jre-headless
* openjdk-6-jre-headless
Try: apt-get install <selected package>
依序執行指令, 就好了
root@liu-VirtualBox:/media/sf_share_data/j2sdk1.4.2_18/bin# sudo apt-get install defailt-jre
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package defailt-jre
root@liu-VirtualBox:/media/sf_share_data# sudo apt-get install default
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package default
root@liu-VirtualBox:/media/sf_share_data#
root@liu-VirtualBox:/media/sf_share_data# sudo apt-get install openjdk-7-jre
DONE
而刪除文件也要下載套件
remove data instance and process :
root@liu-VirtualBox:/media# redir test
The program 'redir' is currently not installed. You can install it by typing:
apt-get install redir
root@liu-VirtualBox:/media# sudo apt-get install redir
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
redir
0 upgraded, 1 newly installed, 0 to remove and 258 not upgraded.
Need to get 18.6 kB of archives.
After this operation, 71.7 kB of additional disk space will be used.
Get:1 http://tw.archive.ubuntu.com/ubuntu/ trusty/universe redir i386 2.2.1-11 [18.6 kB]
Fetched 18.6 kB in 0s (20.4 kB/s)
Selecting previously unselected package redir.
(Reading database ... 165089 files and directories currently installed.)
Preparing to unpack .../redir_2.2.1-11_i386.deb ...
Unpacking redir (2.2.1-11) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up redir (2.2.1-11) ...
讓 USB 可以傳4G以上檔案
一般 USB 預設 File system 都是 FAT32,
所以使用前先格式化, 設定成 NTF就好了.
Let the Usb can be transfer a data bigger than the size of 4 G .
所以使用前先格式化, 設定成 NTF就好了.
Let the Usb can be transfer a data bigger than the size of 4 G .
2016年2月2日 星期二
[Unbuntu]Oracle VM Virtual Box 全螢幕
上方選像中先點選 [裝置] -> [插入 Guest Additions CD 映像]
就會出現 "VBOXADDITIONS_5.0.14_105127" contains software intended to be
automatically started. Would you like to run it?
If you don't trust this location or aren't sure, press Cancel.
[Cancel][Run]
再輸入密碼成位root安裝
就會出現另一個 Virtual Box Guest Additions installation
跑完之後,會有 return or close the window
又邊就會有一個光碟樣子的圖示,
就是安完成, 點下去後就會看到一推檔案.
往下移點選 VBoxWindowsAdditions-x86.exe [32位元]
點選 VBoxWindowsAdditions-amd-x64.exe [64位元]
因為他的位置在 Device 在用終端機的時候要調一下路徑,
也可以直接拉到終端機,
sudo /media/liu/VBOXADDITIONS_5.0.14_105127/VBoxWindowsAdditions-x86 run
因為sudo 會要求再輸入一次密碼.
有沒有裝好, 重新開一次 unbumtu 就知道了 .
就會出現 "VBOXADDITIONS_5.0.14_105127" contains software intended to be
automatically started. Would you like to run it?
If you don't trust this location or aren't sure, press Cancel.
[Cancel][Run]
再輸入密碼成位root安裝
就會出現另一個 Virtual Box Guest Additions installation
跑完之後,會有 return or close the window
又邊就會有一個光碟樣子的圖示,
就是安完成, 點下去後就會看到一推檔案.
往下移點選 VBoxWindowsAdditions-x86.exe [32位元]
點選 VBoxWindowsAdditions-amd-x64.exe [64位元]
因為他的位置在 Device 在用終端機的時候要調一下路徑,
也可以直接拉到終端機,
sudo /media/liu/VBOXADDITIONS_5.0.14_105127/VBoxWindowsAdditions-x86 run
因為sudo 會要求再輸入一次密碼.
有沒有裝好, 重新開一次 unbumtu 就知道了 .
訂閱:
文章 (Atom)