當前位置: 首頁>>代碼示例>>Java>>正文


Java Argon2類代碼示例

本文整理匯總了Java中de.mkammerer.argon2.Argon2的典型用法代碼示例。如果您正苦於以下問題:Java Argon2類的具體用法?Java Argon2怎麽用?Java Argon2使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Argon2類屬於de.mkammerer.argon2包,在下文中一共展示了Argon2類的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testArgon2i

import de.mkammerer.argon2.Argon2; //導入依賴的package包/類
@Test
public void testArgon2i() throws Exception {
    Argon2 sut = Argon2Factory.create(Argon2Factory.Argon2Types.ARGON2i);

    String hash = sut.hash(2, 65536, 1, "password");
    System.out.println(hash);

    assertThat(hash.startsWith("$argon2i$"), is(true));
    assertThat(sut.verify(hash, "password"), is(true));
    assertThat(sut.verify(hash, "not-the-password"), is(false));
}
 
開發者ID:phxql,項目名稱:argon2-jvm,代碼行數:12,代碼來源:LibraryTest.java

示例2: testArgon2iWithChars

import de.mkammerer.argon2.Argon2; //導入依賴的package包/類
@Test
public void testArgon2iWithChars() throws Exception {
    Argon2 sut = Argon2Factory.create(Argon2Factory.Argon2Types.ARGON2i);

    String hash = sut.hash(2, 65536, 1, "password".toCharArray());
    System.out.println(hash);

    assertThat(hash.startsWith("$argon2i$"), is(true));
    assertThat(sut.verify(hash, "password".toCharArray()), is(true));
    assertThat(sut.verify(hash, "not-the-password".toCharArray()), is(false));
}
 
開發者ID:phxql,項目名稱:argon2-jvm,代碼行數:12,代碼來源:LibraryTest.java

示例3: testCharsAreLeftIntact

import de.mkammerer.argon2.Argon2; //導入依賴的package包/類
@Test
public void testCharsAreLeftIntact() throws Exception {
    Argon2 sut = Argon2Factory.create(Argon2Factory.Argon2Types.ARGON2i);

    char[] chars = "password".toCharArray();
    sut.hash(2, 65536, 1, chars);

    assertThat(chars, equalTo("password".toCharArray()));
}
 
開發者ID:phxql,項目名稱:argon2-jvm,代碼行數:10,代碼來源:LibraryTest.java

示例4: testArgon2d

import de.mkammerer.argon2.Argon2; //導入依賴的package包/類
@Test
public void testArgon2d() throws Exception {
    Argon2 sut = Argon2Factory.create(Argon2Factory.Argon2Types.ARGON2d);

    String hash = sut.hash(2, 65536, 1, "password");
    System.out.println(hash);

    assertThat(hash.startsWith("$argon2d$"), is(true));
    assertThat(sut.verify(hash, "password"), is(true));
    assertThat(sut.verify(hash, "not-the-password"), is(false));
}
 
開發者ID:phxql,項目名稱:argon2-jvm,代碼行數:12,代碼來源:LibraryTest.java

示例5: testArgon2dWithChars

import de.mkammerer.argon2.Argon2; //導入依賴的package包/類
@Test
public void testArgon2dWithChars() throws Exception {
    Argon2 sut = Argon2Factory.create(Argon2Factory.Argon2Types.ARGON2d);

    String hash = sut.hash(2, 65536, 1, "password".toCharArray());
    System.out.println(hash);

    assertThat(hash.startsWith("$argon2d$"), is(true));
    assertThat(sut.verify(hash, "password".toCharArray()), is(true));
    assertThat(sut.verify(hash, "not-the-password".toCharArray()), is(false));
}
 
開發者ID:phxql,項目名稱:argon2-jvm,代碼行數:12,代碼來源:LibraryTest.java

示例6: testArgon2id

import de.mkammerer.argon2.Argon2; //導入依賴的package包/類
@Test
public void testArgon2id() throws Exception {
    Argon2 sut = Argon2Factory.create(Argon2Factory.Argon2Types.ARGON2id);

    String hash = sut.hash(2, 65536, 1, "password");
    System.out.println(hash);

    assertThat(hash.startsWith("$argon2id$"), is(true));
    assertThat(sut.verify(hash, "password"), is(true));
    assertThat(sut.verify(hash, "not-the-password"), is(false));
}
 
開發者ID:phxql,項目名稱:argon2-jvm,代碼行數:12,代碼來源:LibraryTest.java

示例7: testArgon2idWithChars

import de.mkammerer.argon2.Argon2; //導入依賴的package包/類
@Test
public void testArgon2idWithChars() throws Exception {
    Argon2 sut = Argon2Factory.create(Argon2Factory.Argon2Types.ARGON2id);

    String hash = sut.hash(2, 65536, 1, "password".toCharArray());
    System.out.println(hash);

    assertThat(hash.startsWith("$argon2id$"), is(true));
    assertThat(sut.verify(hash, "password".toCharArray()), is(true));
    assertThat(sut.verify(hash, "not-the-password".toCharArray()), is(false));
}
 
開發者ID:phxql,項目名稱:argon2-jvm,代碼行數:12,代碼來源:LibraryTest.java

示例8: testArgon2iWithArgs

import de.mkammerer.argon2.Argon2; //導入依賴的package包/類
@Test
public void testArgon2iWithArgs() throws Exception {
    Argon2 sut = Argon2Factory.create(32, 64);

    String hash = sut.hash(2, 65536, 1, "password");
    System.out.println(hash);

    assertThat(hash.startsWith("$argon2i$"), is(true));
    assertThat(sut.verify(hash, "password"), is(true));
    assertThat(sut.verify(hash, "not-the-password"), is(false));
}
 
開發者ID:phxql,項目名稱:argon2-jvm,代碼行數:12,代碼來源:LibraryTest.java

示例9: testArgon2dWithArgs

import de.mkammerer.argon2.Argon2; //導入依賴的package包/類
@Test
public void testArgon2dWithArgs() throws Exception {
    Argon2 sut = Argon2Factory.create(Argon2Factory.Argon2Types.ARGON2d, 32, 64);

    String hash = sut.hash(2, 65536, 1, "password");
    System.out.println(hash);

    assertThat(hash.startsWith("$argon2d$"), is(true));
    assertThat(sut.verify(hash, "password"), is(true));
    assertThat(sut.verify(hash, "not-the-password"), is(false));
}
 
開發者ID:phxql,項目名稱:argon2-jvm,代碼行數:12,代碼來源:LibraryTest.java

示例10: testArgon2idWithArgs

import de.mkammerer.argon2.Argon2; //導入依賴的package包/類
@Test
public void testArgon2idWithArgs() throws Exception {
    Argon2 sut = Argon2Factory.create(Argon2Factory.Argon2Types.ARGON2id, 32, 64);

    String hash = sut.hash(2, 65536, 1, "password");
    System.out.println(hash);

    assertThat(hash.startsWith("$argon2id$"), is(true));
    assertThat(sut.verify(hash, "password"), is(true));
    assertThat(sut.verify(hash, "not-the-password"), is(false));
}
 
開發者ID:phxql,項目名稱:argon2-jvm,代碼行數:12,代碼來源:LibraryTest.java

示例11: testUTF8

import de.mkammerer.argon2.Argon2; //導入依賴的package包/類
@Test
public void testUTF8() throws Exception {
    String password = "ŧҺìş ίŝ ứţƒ-8";

    Argon2 sut = Argon2Factory.create();
    String hash = sut.hash(2, 65535, 1, password, Charset.forName("UTF-8"));
    assertThat(sut.verify(hash, password, Charset.forName("UTF-8")), is(true));
}
 
開發者ID:phxql,項目名稱:argon2-jvm,代碼行數:9,代碼來源:LibraryTest.java

示例12: testWipeArray

import de.mkammerer.argon2.Argon2; //導入依賴的package包/類
@Test
public void testWipeArray() throws Exception {
    char[] array = "Hello, Argon2".toCharArray();

    Argon2 sut = Argon2Factory.create();
    sut.wipeArray(array);

    for (char c : array) {
        assertThat(c, is((char) 0));
    }
}
 
開發者ID:phxql,項目名稱:argon2-jvm,代碼行數:12,代碼來源:LibraryTest.java

示例13: testInvalidParameters

import de.mkammerer.argon2.Argon2; //導入依賴的package包/類
@Test(expected = IllegalStateException.class)
public void testInvalidParameters() throws Exception {
    Argon2 sut = Argon2Factory.create();

    sut.hash(0, 0, 0, "password");
}
 
開發者ID:phxql,項目名稱:argon2-jvm,代碼行數:7,代碼來源:LibraryTest.java


注:本文中的de.mkammerer.argon2.Argon2類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。