File tree Expand file tree Collapse file tree 7 files changed +145
-0
lines changed
main/java/io/github/libpasta
test/java/io/github/libpasta Expand file tree Collapse file tree 7 files changed +145
-0
lines changed Original file line number Diff line number Diff line change 1+ target /
Original file line number Diff line number Diff line change 1+ [submodule "pasta-bindings "]
2+ path = pasta-bindings
3+ url = https://github.com/libpasta/pasta-bindings/
Original file line number Diff line number Diff line change 1+ <project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
2+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" >
3+ <modelVersion >4.0.0</modelVersion >
4+ <groupId >io.github.libpasta</groupId >
5+ <artifactId >libpasta-java</artifactId >
6+ <packaging >jar</packaging >
7+ <version >0.0.4</version >
8+ <name >libpasta-java</name >
9+ <url >https://libpasta.github.io/</url >
10+ <dependencies >
11+ <dependency >
12+ <groupId >junit</groupId >
13+ <artifactId >junit</artifactId >
14+ <version >3.8.1</version >
15+ <scope >test</scope >
16+ </dependency >
17+ <dependency >
18+ <groupId >org.scijava</groupId >
19+ <artifactId >native-lib-loader</artifactId >
20+ <version >2.2.0</version >
21+ </dependency >
22+ </dependencies >
23+
24+ <build >
25+ <plugins >
26+ <!-- any other plugins -->
27+ <plugin >
28+ <artifactId >maven-assembly-plugin</artifactId >
29+ <executions >
30+ <execution >
31+ <phase >package</phase >
32+ <goals >
33+ <goal >single</goal >
34+ </goals >
35+ </execution >
36+ </executions >
37+ <configuration >
38+ <descriptorRefs >
39+ <descriptorRef >jar-with-dependencies</descriptorRef >
40+ </descriptorRefs >
41+ </configuration >
42+ </plugin >
43+ </plugins >
44+ </build >
45+ </project >
Original file line number Diff line number Diff line change 1+ /* ----------------------------------------------------------------------------
2+ * This file was automatically generated by SWIG (http://www.swig.org).
3+ * Version 3.0.12
4+ *
5+ * Do not make changes to this file unless you know what you are doing--modify
6+ * the SWIG interface file instead.
7+ * ----------------------------------------------------------------------------- */
8+ package io .github .libpasta ;
9+
10+ public class pasta {
11+ public static String hash_password (String password ) {
12+ return pastaJNI .hash_password (password );
13+ }
14+
15+ public static boolean verify_password (String hash , String password ) {
16+ return pastaJNI .verify_password (hash , password );
17+ }
18+
19+ public static void free_string (String arg0 ) {
20+ pastaJNI .free_string (arg0 );
21+ }
22+
23+ public static String read_password (String prompt ) {
24+ return pastaJNI .read_password (prompt );
25+ }
26+
27+ }
Original file line number Diff line number Diff line change 1+ /* ----------------------------------------------------------------------------
2+ * This file was automatically generated by SWIG (http://www.swig.org).
3+ * Version 3.0.12
4+ *
5+ * Do not make changes to this file unless you know what you are doing--modify
6+ * the SWIG interface file instead.
7+ * ----------------------------------------------------------------------------- */
8+ package io .github .libpasta ;
9+
10+ import org .scijava .nativelib .*;
11+
12+ public class pastaJNI {
13+
14+ static {
15+ try {
16+ NativeLibraryUtil .loadNativeLibrary (pastaJNI .class , "pasta_jni" );
17+ } catch (Exception e ) {
18+ System .err .println ("Native code library failed to load. \n " + e );
19+ System .exit (1 );
20+ }
21+ }
22+
23+ public final static native String hash_password (String jarg1 );
24+ public final static native boolean verify_password (String jarg1 , String jarg2 );
25+ public final static native void free_string (String jarg1 );
26+ public final static native String read_password (String jarg1 );
27+ }
Original file line number Diff line number Diff line change 1+ package io .github .libpasta ;
2+
3+ import junit .framework .Test ;
4+ import junit .framework .TestCase ;
5+ import junit .framework .TestSuite ;
6+
7+ /**
8+ * Unit test for simple App.
9+ */
10+ public class AppTest
11+ extends TestCase
12+ {
13+ /**
14+ * Create the test case
15+ *
16+ * @param testName name of the test case
17+ */
18+ public AppTest ( String testName )
19+ {
20+ super ( testName );
21+ }
22+
23+ /**
24+ * @return the suite of tests being tested
25+ */
26+ public static Test suite ()
27+ {
28+ return new TestSuite ( AppTest .class );
29+ }
30+
31+ /**
32+ * Rigourous Test :-)
33+ */
34+ public void testApp ()
35+ {
36+ // assertTrue( true );
37+ String hash = pasta .hash_password ("hello123" );
38+ assert pasta .verify_password (hash , "hello123" );
39+ System .out .println ((char )27 + "[1;32mJava test passed." + (char )27 + "[m" );
40+ }
41+ }
You can’t perform that action at this time.
0 commit comments