+        }
29
+
30
+        os.flush();
31
+        os.close();
32
+        is.close();
33
+    }
34
+
35
+    public static void xorFile(String filename, String dest, byte[] password, long encryptByteCount) throws IOException {
36
+        FileInputStream is = new FileInputStream(filename);
37
+        FileOutputStream os = new FileOutputStream(dest);
38
+
39
+        byte[] data = new byte[1024 * 4]; //4 KB buffer
40
+        int read = is.read(data), index = 0, encryptCnt = 0;
41
+        while (read != -1) {
42
+            for (int k = 0; k < read; k++) {
43
+                if (encryptCnt < encryptByteCount) {
44
+                    data[k] ^= password[index % password.length];
45
+                    index++;
46
+                    encryptCnt++;
47
+                }
48
+            }
49
+            os.write(data, 0, read);
50
+            read = is.read(data);
51
+        }
52
+
53
+        os.flush();
54
+        os.close();
55
+        is.close();
56
+    }
57
+
58
+}

+ 32 - 0
app/src/main/res/layout/activity_encrypt.xml

@@ -0,0 +1,32 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+    android:layout_width="match_parent"
4
+    android:layout_height="match_parent"
5
+    android:background="@color/background_light_grey_color">
6
+
7
+    <RelativeLayout
8
+        android:id="@+id/title_layout"
9
+        android:layout_width="match_parent"
10
+        android:layout_height="wrap_content"
11
+        android:background="@color/colorPrimaryDark">
12
+        <include layout="@layout/title_bar_with_back_and_option" />
13
+    </RelativeLayout>
14
+
15
+    <ImageView
16
+        android:id="@+id/image_encrypt"
17
+        android:layout_width="match_parent"
18
+        android:layout_height="300dp"
19
+        android:scaleType="centerInside"
20
+        android:layout_below="@id/title_layout"/>
21
+
22
+    <Button
23
+        android:id="@+id/btn_encrypt"
24
+        android:layout_width="100dp"
25
+        android:layout_height="48dp"
26
+        android:layout_alignParentBottom="true"
27
+        android:layout_marginBottom="60dp"
28
+        android:layout_centerHorizontal="true"
29
+        android:gravity="center"/>
30
+
31
+
32
+</RelativeLayout>

pai2 - Gogs: Go Git Service

拍爱

Brightcells: 102152ca4a add api lensman_photo_bought & modify api wx_order_create_api and adjust return field 10 年之前
..
0001_initial.py 30daca135b add api message_list_api/message_type_list_api/message_read_api 10 年之前
0002_auto_20160120_1830.py a121b75ff2 add db_index=True for status field 10 年之前
0003_systemmessageinfo_systemmessagereadinfo.py 165424743a modify message relative apis 10 年之前
0004_systemmessagedeleteinfo.py 165424743a modify message relative apis 10 年之前
0005_auto_20160422_1322.py 102152ca4a add api lensman_photo_bought & modify api wx_order_create_api and adjust return field 10 年之前
__init__.py 30daca135b add api message_list_api/message_type_list_api/message_read_api 10 年之前