新需求更新 同步更新
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
package com.nanri.aiimage.modules.auth.util;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
class WerkzeugPasswordEncoderTest {
|
||||
|
||||
private final WerkzeugPasswordEncoder encoder = new WerkzeugPasswordEncoder();
|
||||
|
||||
@Test
|
||||
void matchesWerkzeugScryptHash() {
|
||||
String hash = "scrypt:32768:8:1$VEWwSnHkAFcK3B3E$2065ba2db25c34072bf4d7ae9bd47b8c483289fafc3f5e98ae49bb232d30bf989b21ae0e9f14adc6e893e34a81543cf58641731431961ed9ab353bcebec2e78a";
|
||||
|
||||
assertTrue(encoder.matches("test-password", hash));
|
||||
assertFalse(encoder.matches("wrong-password", hash));
|
||||
}
|
||||
|
||||
@Test
|
||||
void matchesGeneratedPbkdf2Hash() {
|
||||
String hash = encoder.hash("test-password");
|
||||
|
||||
assertTrue(encoder.matches("test-password", hash));
|
||||
assertFalse(encoder.matches("wrong-password", hash));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user