public abstract class MessageDigestSpi extends Object
MessageDigest
类,它提供了一个消息摘要算法的功能,如MD5和SHA。消息摘要是安全的单向哈希函数接受任意大小的数据,输出一个固定长度的哈希值。
在这个类中的所有的抽象方法必须实现由一个加密服务提供者,希望提供一个特定的消息摘要算法的实现。
实现自由实现Cloneable接口。
MessageDigest
Constructor and Description |
---|
MessageDigestSpi() |
Modifier and Type | Method and Description |
---|---|
Object |
clone()
返回一个克隆如果实现Cloneable。
|
protected abstract byte[] |
engineDigest()
通过执行诸如填充之类的最终操作来完成哈希计算。
|
protected int |
engineDigest(byte[] buf, int offset, int len)
通过执行诸如填充之类的最终操作来完成哈希计算。
|
protected int |
engineGetDigestLength()
返回以字节为单位的摘要长度。
|
protected abstract void |
engineReset()
重置为进一步利用消化。
|
protected abstract void |
engineUpdate(byte input)
使用指定的字节来更新摘要。
|
protected abstract void |
engineUpdate(byte[] input, int offset, int len)
使用指定的偏移量开始在指定的偏移量上更新使用指定的字节数组的摘要。
|
protected void |
engineUpdate(ByteBuffer input)
使用指定的ByteBuffer更新摘要。
|
protected int engineGetDigestLength()
这种具体方法已被添加到这个以前定义的抽象类。(对于向后兼容性,它不可能是抽象的。)
默认的行为是返回0。
这种方法可以被提供者返回摘要长度。
protected abstract void engineUpdate(byte input)
input
-字节用于更新。
protected abstract void engineUpdate(byte[] input, int offset, int len)
input
-字节用于更新阵列。
offset
-偏移量开始从字节数组。
len
-使用的字节数,从
offset
。
protected void engineUpdate(ByteBuffer input)
input.remaining()
字节开始
input.position()
更新。当返回时,缓冲区的位置将等于它的极限,它的限制不会改变。
input
- ByteBuffer
protected abstract byte[] engineDigest()
engineDigest
一直叫,发动机应复位(见
engineReset
)。复位是发动机实现者的责任。
protected int engineDigest(byte[] buf, int offset, int len) throws DigestException
engineDigest
一直叫,发动机应复位(见
engineReset
)。复位是发动机实现者的责任。这种方法应该是抽象的,但我们留给它的具体的二进制兼容性。有知识的提供者应该重写此方法。
buf
-输出缓冲区中存储的消化
offset
偏移开始从输出缓冲区
len
消化。这个默认的实现和太阳提供者不回部分消化。这个参数的存在完全是为了我们的API。一致性如果这个参数的值小于实际消化的长度,方法将抛出一个digestexception。此参数被忽略,如果它的值大于或等于实际的消化长度。
DigestException
-如果出现错误。
protected abstract void engineReset()
public Object clone() throws CloneNotSupportedException
clone
方法重写,继承类
Object
CloneNotSupportedException
-如果这是号召,不支持
Cloneable
实施。
Cloneable
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.