kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liy...@apache.org
Subject [kylin] 01/10: minor, add main func for EncryptUtil
Date Tue, 03 Apr 2018 06:50:39 GMT
This is an automated email from the ASF dual-hosted git repository.

liyang pushed a commit to branch sync
in repository https://gitbox.apache.org/repos/asf/kylin.git

commit ad16eaf7b3c53b2a6482bd4adfa6f89eb4744c88
Author: shaofengshi <shaofengshi@apache.org>
AuthorDate: Sat Mar 17 09:34:58 2018 +0800

    minor, add main func for EncryptUtil
---
 .../java/org/apache/kylin/common/util/EncryptUtil.java | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/core-common/src/main/java/org/apache/kylin/common/util/EncryptUtil.java b/core-common/src/main/java/org/apache/kylin/common/util/EncryptUtil.java
index 309fb3d..482b949 100644
--- a/core-common/src/main/java/org/apache/kylin/common/util/EncryptUtil.java
+++ b/core-common/src/main/java/org/apache/kylin/common/util/EncryptUtil.java
@@ -27,7 +27,8 @@ public class EncryptUtil {
     /**
      * thisIsAsecretKey
      */
-    private static byte[] key = { 0x74, 0x68, 0x69, 0x73, 0x49, 0x73, 0x41, 0x53, 0x65, 0x63,
0x72, 0x65, 0x74, 0x4b, 0x65, 0x79 };
+    private static byte[] key = { 0x74, 0x68, 0x69, 0x73, 0x49, 0x73, 0x41, 0x53, 0x65, 0x63,
0x72, 0x65, 0x74, 0x4b,
+            0x65, 0x79 };
 
     public static String encrypt(String strToEncrypt) {
         try {
@@ -52,4 +53,19 @@ public class EncryptUtil {
             throw new RuntimeException(e.getMessage(), e);
         }
     }
+
+    private static void printUsage() {
+        System.out.println("Usage: java org.apache.kylin.common.util <your_password>");
+    }
+
+    public static void main(String[] args) {
+        if (args.length != 1) {
+            printUsage();
+            System.exit(1);
+        }
+
+        String passwordTxt = args[0];
+        // for encrypt password like LDAP password
+        System.out.println(EncryptUtil.encrypt(passwordTxt));
+    }
 }

-- 
To stop receiving notification emails like this one, please contact
liyang@apache.org.

Mime
View raw message