Best android open-source packages and libraries.

Hydride android

Hydride binds against Libhydrogen to provide a simple cryptography that is compatible with Android API 16 and above.
Updated 2 months ago

Hydride (Android)

Hydride is an Android encryption library that allows developers to incorporate amazing cryptography that is compatible on a wide range of platforms into their projects. Hydride uses the Libhydrogen project via JNA wrapping.

Installation

Hydride is available via JCenter and Bintray.

// Top-level build.gradle
repositories {
    // If wanting to use via jCenter/mavenCentral
    mavenCentral()
    // If wanting to use via Bintray
    maven {
        url  "https://dl.bintray.com/libly/maven"
    }
}

dependencies {
    // ...
    implementation 'co.libly:hydride-android:0.1.3@aar' // Add this line
}

Supported platforms

Unlike other implementations, Hydride packages the libhydrogen shared libraries within itself so you don't have to waste time compiling them. Other implementations probably force you to build those shared libraries or include a build step to build those shared libraries which, in my experience, fail most of the time. Platforms that are currently supported:

  • Android 16 and above.

Usage

To get started simple initialise an Hydrogen object and use its methods. Here's a simple example to get started:

// Initialise
Native.register(Hydrogen.class, "hydrogen");
Hydrogen hydrogen = new Hydrogen();
hydrogen.hydro_init();

// Make a key
byte[] key = new byte[Hydrogen.HYDRO_SIGN_SECRETKEYBYTES];
hydrogen.hydro_secretbox_keygen(key);

// Make a cipher array to hold the resulting encrypted text
String message = "This is a message that will be encrypted.";
byte[] messageBytes = message.getBytes();
byte[] cipher = new byte[Hydrogen.HYDRO_SECRETBOX_HEADERBYTES + messageBytes.length];
String context = "context1";
byte[] contextBytes = context.getBytes();
long messageId = 1L;

// Now encrypt
int encryptSuccess = hydrogen.hydro_secretbox_encrypt(cipher, messageBytes, messageBytes.length, messageId, contextBytes, key);

For more information on how to use please refer to the Libhydrogen wiki where you can find a full list of all available operations. Just use hydrogen.your_operation_name() to use them.

Hydride (Java)

If you are looking for the Java variant of Hydride then look no further, click here to access Hydride for Java.

Tags hashing