APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.security.provider

pack-priv abstract Class SHA5

extends DigestBase
Class Inheritance
Known Direct Subclasses
sun.security.provider.SHA5.SHA512, sun.security.provider.SHA5.SHA384, sun.security.provider.SHA5.SHA512_224, sun.security.provider.SHA5.SHA512_256
Imports
java.util.Arrays, .Objects, jdk.internal.util.Preconditions, jdk.internal.vm.annotation.IntrinsicCandidate

This class implements the Secure Hash Algorithm SHA-384 and SHA-512 developed by the National Institute of Standards and Technology along with the National Security Agency. The two algorithms are almost identical. This file contains a base class SHA5 and two nested static subclasses as the classes to be used by the JCA framework.

It implements java.security.MessageDigestSpi, and can be used through Java Cryptography Architecture (JCA), as a pluggable MessageDigest implementation.

Authors
Valerie Peng, Andreas Sterbenz
Since
1.4.2

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
SHA5.SHA384

SHA-384 implementation class.

public static class
SHA5.SHA512

SHA-512 implementation class.

public static class
public static class

Field Summary

Modifier and TypeField and Description
private final long[]
private static final int
private static final long[]
private long[]
private long[]
W

Inherited from sun.security.provider.DigestBase:
blockSizebufferbytesProcessedpadding

Constructor Summary

AccessConstructor and Description
pack-priv
SHA5(String name, int digestLength, long[] initialHashes)

Creates a new SHA object.

Method Summary

Modifier and TypeMethod and Description
public Object
clone()

Overrides sun.security.provider.DigestBase.clone.

Returns a clone if the implementation is cloneable.

pack-priv final void
implCompress(byte[] buf, int ofs)

Implements abstract sun.security.provider.DigestBase.implCompress.

Compute the hash for the current block.

private void
implCompress0(byte[] buf, int ofs)

private void
implCompressCheck(byte[] buf, int ofs)

pack-priv final void
implDigest(byte[] out, int ofs)

Implements abstract sun.security.provider.DigestBase.implDigest.

Return the digest.

pack-priv final void
implReset()

Implements abstract sun.security.provider.DigestBase.implReset.

Reset subclass specific state to their initial values.

private static long

Returns:

(x and y) xor ((complement x) and z)
lf_ch
(long
long
x
,
long
long
y
,
long
long
z
)

logical function ch(x,y,z) as defined in spec:

private static long

Returns:

long
lf_delta0
(long
long
x
)

logical function delta0(x) - xor of results of right shifts/rotations

private static long

Returns:

long
lf_delta1
(long
long
x
)

logical function delta1(x) - xor of results of right shifts/rotations

private static long

Returns:

(x and y) xor (x and z) xor (y and z)
lf_maj
(long
long
x
,
long
long
y
,
long
long
z
)

logical function maj(x,y,z) as defined in spec:

private static long

Returns:

x right shift for s times
lf_R
(long
long
x
,
int
int
s
)

logical function R(x,s) - right shift

private static long

Returns:

x circular right shift for s times
lf_S
(long
long
x
,
int
int
s
)

logical function S(x,s) - right rotation

private static long

Returns:

S(x,28) xor S(x,34) xor S(x,39)
lf_sigma0
(long
long
x
)

logical function sigma0(x) - xor of results of right rotations

private static long

Returns:

S(x,14) xor S(x,18) xor S(x,41)
lf_sigma1
(long
long
x
)

logical function sigma1(x) - xor of results of right rotations

private void
Inherited from sun.security.provider.DigestBase:
engineDigestengineDigestengineGetDigestLengthengineResetengineUpdateengineUpdateimplDigestFixedLengthPreprocessed

Field Detail

initialHashesback to summary
private final long[] initialHashes
ITERATIONback to summary
private static final int ITERATION
ROUND_CONSTSback to summary
private static final long[] ROUND_CONSTS
stateback to summary
private long[] state
Wback to summary
private long[] W

Constructor Detail

SHA5back to summary
pack-priv SHA5(String name, int digestLength, long[] initialHashes)

Creates a new SHA object.

Method Detail

cloneback to summary
public Object clone() throws CloneNotSupportedException

Overrides sun.security.provider.DigestBase.clone.

Doc from java.security.MessageDigestSpi.clone.

Returns a clone if the implementation is cloneable.

Exceptions
CloneNotSupportedException:
if this is called on an implementation that does not support Cloneable.
implCompressback to summary
pack-priv final void implCompress(byte[] buf, int ofs)

Implements abstract sun.security.provider.DigestBase.implCompress.

Compute the hash for the current block. This is in the same vein as Peter Gutmann's algorithm listed in the back of Applied Cryptography, Compact implementation of "old" NIST Secure Hash Algorithm.

implCompress0back to summary
private void implCompress0(byte[] buf, int ofs)
Annotations
@IntrinsicCandidate
implCompressCheckback to summary
private void implCompressCheck(byte[] buf, int ofs)
implDigestback to summary
pack-priv final void implDigest(byte[] out, int ofs)

Implements abstract sun.security.provider.DigestBase.implDigest.

Doc from sun.security.provider.DigestBase.implDigest.

Return the digest. Subclasses do not need to reset() themselves, DigestBase calls implReset() when necessary.

implResetback to summary
pack-priv final void implReset()

Implements abstract sun.security.provider.DigestBase.implReset.

Doc from sun.security.provider.DigestBase.implReset.

Reset subclass specific state to their initial values. DigestBase calls this method when necessary.

lf_chback to summary
private static long lf_ch(long x, long y, long z)

logical function ch(x,y,z) as defined in spec:

Parameters
x:long

long

y:long

long

z:long

long

Returns:long

(x and y) xor ((complement x) and z)

lf_delta0back to summary
private static long lf_delta0(long x)

logical function delta0(x) - xor of results of right shifts/rotations

Parameters
x:long

long

Returns:long

long

lf_delta1back to summary
private static long lf_delta1(long x)

logical function delta1(x) - xor of results of right shifts/rotations

Parameters
x:long

long

Returns:long

long

lf_majback to summary
private static long lf_maj(long x, long y, long z)

logical function maj(x,y,z) as defined in spec:

Parameters
x:long

long

y:long

long

z:long

long

Returns:long

(x and y) xor (x and z) xor (y and z)

lf_Rback to summary
private static long lf_R(long x, int s)

logical function R(x,s) - right shift

Parameters
x:long

long

s:int

int

Returns:long

x right shift for s times

lf_Sback to summary
private static long lf_S(long x, int s)

logical function S(x,s) - right rotation

Parameters
x:long

long

s:int

int

Returns:long

x circular right shift for s times

lf_sigma0back to summary
private static long lf_sigma0(long x)

logical function sigma0(x) - xor of results of right rotations

Parameters
x:long

long

Returns:long

S(x,28) xor S(x,34) xor S(x,39)

lf_sigma1back to summary
private static long lf_sigma1(long x)

logical function sigma1(x) - xor of results of right rotations

Parameters
x:long

long

Returns:long

S(x,14) xor S(x,18) xor S(x,41)

resetHashesback to summary
private void resetHashes()
sun.security.provider back to summary

public final Class SHA5.SHA384

extends SHA5
Class Inheritance

SHA-384 implementation class.

Field Summary

Modifier and TypeField and Description
private static final long[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from sun.security.provider.SHA5:
cloneimplCompressimplDigestimplReset

Field Detail

INITIAL_HASHESback to summary
private static final long[] INITIAL_HASHES

Constructor Detail

SHA384back to summary
public SHA384()
sun.security.provider back to summary

public final Class SHA5.SHA512

extends SHA5
Class Inheritance

SHA-512 implementation class.

Field Summary

Modifier and TypeField and Description
private static final long[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from sun.security.provider.SHA5:
cloneimplCompressimplDigestimplReset

Field Detail

INITIAL_HASHESback to summary
private static final long[] INITIAL_HASHES

Constructor Detail

SHA512back to summary
public SHA512()
sun.security.provider back to summary

public final Class SHA5.SHA512_224

extends SHA5
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final long[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from sun.security.provider.SHA5:
cloneimplCompressimplDigestimplReset

Field Detail

INITIAL_HASHESback to summary
private static final long[] INITIAL_HASHES

Constructor Detail

SHA512_224back to summary
public SHA512_224()
sun.security.provider back to summary

public final Class SHA5.SHA512_256

extends SHA5
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final long[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from sun.security.provider.SHA5:
cloneimplCompressimplDigestimplReset

Field Detail

INITIAL_HASHESback to summary
private static final long[] INITIAL_HASHES

Constructor Detail

SHA512_256back to summary
public SHA512_256()