当前位置: 首页>>代码示例>>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;未经允许,请勿转载。