hash() — netty Function Reference
Architecture documentation for the hash() function in PseudoRandomFunction.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD a87902db_61fe_7a64_914d_ac398f987472["hash()"] 431b76bc_7e00_cc48_26d9_b766666a6d12["PseudoRandomFunction"] a87902db_61fe_7a64_914d_ac398f987472 -->|defined in| 431b76bc_7e00_cc48_26d9_b766666a6d12 78dde20e_4bff_6001_62fe_1c7953a28da7["concat()"] a87902db_61fe_7a64_914d_ac398f987472 -->|calls| 78dde20e_4bff_6001_62fe_1c7953a28da7 style a87902db_61fe_7a64_914d_ac398f987472 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
handler/src/main/java/io/netty/handler/ssl/PseudoRandomFunction.java lines 63–87
static byte[] hash(byte[] secret, byte[] label, byte[] seed, int length, String algo) {
checkPositiveOrZero(length, "length");
try {
Mac hmac = Mac.getInstance(algo);
hmac.init(new SecretKeySpec(secret, algo));
/*
* P_hash(secret, seed) = HMAC_hash(secret, A(1) + seed) +
* HMAC_hash(secret, A(2) + seed) + HMAC_hash(secret, A(3) + seed) + ...
* where + indicates concatenation. A() is defined as: A(0) = seed, A(i)
* = HMAC_hash(secret, A(i-1))
*/
int iterations = (int) Math.ceil(length / (double) hmac.getMacLength());
byte[] expansion = EmptyArrays.EMPTY_BYTES;
byte[] data = concat(label, seed);
byte[] A = data;
for (int i = 0; i < iterations; i++) {
A = hmac.doFinal(A);
expansion = concat(expansion, hmac.doFinal(concat(A, data)));
}
return Arrays.copyOf(expansion, length);
} catch (GeneralSecurityException e) {
throw new IllegalArgumentException("Could not find algo: " + algo, e);
}
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does hash() do?
hash() is a function in the netty codebase, defined in handler/src/main/java/io/netty/handler/ssl/PseudoRandomFunction.java.
Where is hash() defined?
hash() is defined in handler/src/main/java/io/netty/handler/ssl/PseudoRandomFunction.java at line 63.
What does hash() call?
hash() calls 1 function(s): concat.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free