B4J Question Faster Encryption Library (tested - it is not faster)... found one but how I will make it work ?

Magma

Expert
Licensed User
Longtime User
Hi there...
well I am searching various things to make my work faster... B4XEncryption is very fast... but this says it is faster (edit: IT IS NOT !!!)... and I want to test it...


I wanna try it... but somewhere loosing something... (as always) - any help appreciated!

What i ve done:
B4X:
    #AdditionalJar: crypto-core-1.1.0.jar

B4X:
    Private joMe As JavaObject
    Dim startTime, stopTime As Long

    joMe=Me
   
    startTime = DateTime.Now
    Dim bb2() As Byte=joMe.RunMethod("cencrypt",Array("testpass",bb))  ''bb could be bytes from image or something else
    stopTime = DateTime.Now
    Log(bb2.Length)
    Log("encrypt time " & (stopTime-startTime) & "ms")

...

#if Java


import crypto.AES;
import crypto.Key;
import crypto.Util;


   public static byte[] cencrypt(String ppass, byte[] ssomedata) throws Exception {
   try {
   Key.ExpandedKey key = Key.KeySize.AES_128.genKeysHmacSha(ppass.getBytes());
   byte[] encryptedData = crypto.AES.encryptCBC(key, ssomedata);
    return encryptedData;
   } catch (Exception e) {
    e.printStackTrace();
    return null;
      }
   }
  
   public static byte[] cdecrypt(String ppass, byte[] ssomedata) throws Exception {
   try {
   Key.ExpandedKey key = Key.KeySize.AES_128.genKeysHmacSha(ppass.getBytes());
   byte[] decryptedData = crypto.AES.decryptGCM(key, ssomedata);
    return decryptedData;
   } catch (Exception e) {
    e.printStackTrace();
    return null;
      }
   }

#End If


getting this error:
 
Last edited:
Solution
Cookies are required to use this site. You must accept them to continue using the site. Learn more…