package org.abstractj.kalium;

import jnr.ffi.provider.FFIProvider;

public interface NaCl {

    String LIBRARY_NAME = "sodium";

    public static final Sodium SODIUM_INSTANCE = FFIProvider.getSystemProvider()
            .createLibraryLoader(Sodium.class)
            .library(LIBRARY_NAME)
            .load();

    public interface Sodium {

        public String sodium_version_string();

        public int crypto_hash_sha256_ref(byte[] buffer, String message, long sizeof);

        public int crypto_hash_sha512_ref(byte[] buffer, String message, long sizeof);
    }
}
@@ -24,16 +24,46 @@
 alium;%0A%0A
+import jnr.ffi.LibraryLoader;%0A
 import j
@@ -99,25 +99,21 @@
 %0Apublic 
-interface
+class
  NaCl %7B%0A
@@ -117,45 +117,8 @@
  %7B%0A%0A
-    String LIBRARY_NAME = %22sodium%22;%0A%0A
     
@@ -163,144 +163,65 @@
 ANCE
- = FFIProvider.getSystemProvider()%0A            .createLibraryLoader(Sodium.class)%0A            .library(LIBRARY_NAME)%0A            .load()
+;%0A    private static final String LIBRARY_NAME = %22sodium%22
 ;%0A%0A 
@@ -478,10 +478,247 @@
 );%0A    %7D
+%0A%0A    static %7B%0A        LibraryLoader%3CSodium%3E libraryLoader = FFIProvider.getSystemProvider()%0A                .createLibraryLoader(Sodium.class)%0A                .library(LIBRARY_NAME);%0A        SODIUM_INSTANCE = libraryLoader.load();%0A    %7D
 %0A%7D

refactor into two steps to aid debugging