This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[((ord(s[i])-97)*10.24, (ord(s[i+1])-97)*10.24, (ord(s[i+2])-97)*10.24, (ord(s[i+3])-97)*10.24) for i in range(0, len(s), 4)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <mpi.h> | |
#include "config.h" | |
#define ROOT 0 | |
void showDistances(int matrix[], int n); | |
void populateMatrix(int matrix[], int n, int density, int rank, int processes); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#include "config.h" | |
void showDistances(int matrix[], int n); | |
void populateMatrix(int* matrix, int n, int density); | |
void floydWarshall(int* matrix, int n); | |
int main(int argc, char** argv) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int minimumTime = 1500; | |
BenchmarkResult<BcryptFunction> benchmark = SystemChecker.benchmarkBcrypt(minimumTime); | |
benchmark.getElapsed(); // 929ms | |
benchmark.getPrototype(); // BcryptFunction object with 14 rounds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String userPassword = "my password"; | |
String oldHash = "$2y$06$pWbj0v7UGWgOp1mXWfCt1OUAibk5luL758NoVndquXnXfH79zFTRG"; | |
BcryptFunction bcrypt = BcryptFunction.getInstanceFromHash(oldHash); | |
Argon2Function argon2 = Argon2Function.getInstance(14, 20, 1, 32, Argon2.ID); | |
HashUpdate update = Password.check(userPassword, oldHash) | |
.andUpdate() | |
.with(bcrypt, argon2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String hash = "$argon2id$v=19$m=14,t=20,p=1$cHJpdmF0ZS1zYWx0$mxKlVBKpr3lNXHdaBKnuvjl/IsESYkYPCFAsb7VaIGs"; | |
Argon2Function argon2 = Argon2Function.getInstanceFromHash(hash); | |
boolean verified = Password.check("my password", hash) | |
.addPepper("shared-secret") | |
.with(argon2); | |
// true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Argon2Function argon2 = Argon2Function.getInstance(14, 20, 1, 32, Argon2.ID); | |
boolean verified = Password.check("my password", "$argon2id$v=19$m=14,t=20,p=1$cHJpdmF0ZS1zYWx0$mxKlVBKpr3lNXHdaBKnuvjl/IsESYkYPCFAsb7VaIGs") | |
.addPepper("shared-secret") | |
.with(argon2); | |
// true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Argon2Function argon2 = Argon2Function.getInstance(14, 20, 1, 32, Argon2.ID); | |
Hash hash = Password.hash("my password") | |
.addPepper("shared-secret") | |
.addSalt("private-salt") | |
.with(argon2); | |
hash.getResult(); // $argon2id$v=19$m=14,t=20,p=1$cHJpdmF0ZS1zYWx0$mxKlVBKpr3lNXHdaBKnuvjl/IsESYkYPCFAsb7VaIGs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String hash = "$100801$cHJpdmF0ZS1zYWx0$ibAGantBIzk0Zcpl11VLaywBOdVA4mgrwTkIxWbNYBsIDROtTIMGULxMS9AJj7MOs74D/fQk6WtodZ1115i5wg=="; | |
ScryptFunction scrypt = ScryptFunction.getInstanceFromHash(hash); | |
boolean verified = Password.check("my password", hash) | |
.addPepper("shared-secret") | |
.with(scrypt); | |
// true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ScryptFunction scrypt = ScryptFunction.getInstance(1<<16, 8, 1); | |
boolean verified = Password.check("my password", "$100801$cHJpdmF0ZS1zYWx0$ibAGantBIzk0Zcpl11VLaywBOdVA4mgrwTkIxWbNYBsIDROtTIMGULxMS9AJj7MOs74D/fQk6WtodZ1115i5wg==") | |
.addPepper("shared-secret") | |
.with(scrypt); | |
// true |
NewerOlder