Typically, it behaves like a hash function: a minor change in the message or in the key results to totally different MAC value.It should be practically infeasible to change the key or the message and get the same MAC value.MAC codes, like hashes, are irreversible: it is impossible to recover the original message or the key from the MAC code.MAC algorithms are also known as 'keyed hash. About Oracle Crypto Features and Benefits Oracle Crypto supports public key cryptography algorithms, digital signature algorithms, key exchange algorithms, symmetric cryptography algorithms, message digest algorithms, MAC algorithms, and methods for building and parsing ASN.1 objects.; About the Oracle Crypto Packages Oracle Crypto contains packages of basic cryptographic primitives, utility. Encrypto is a free, easy-to-use app that lets you encrypt files with AES-256 encryption and then send them to friends or coworkers. It works on both Mac and Windows, so you can send encrypted files without worrying whether the other person can open it or not. Protect Files with AES-256 Encryption T. All Implemented Interfaces: Cloneable. Public class Mac extends Object implements Cloneable. This class provides the functionality of a 'Message Authentication Code' (MAC) algorithm. A MAC provides a way to check the integrity of information transmitted over or stored in an unreliable medium, based on a secret key.
CryptoTab Browser is a special web browser with built-in mining features. Familiar Chrome user interface combined with extremely fast mining speed. Mine and browse at the same time!
Encrypto lets you encrypt files before sending them to friends or coworkers. Drop a file into Encrypto, set a password, and then send it with added security.
Secure any file with AES-256 encryption
Encrypto takes any file or folder and adds AES-256 encryption to it. With encryption, you know your file is incredibly secure and that only the right person can access it.
Create a password hint
Rather than relay a password to the recipient, include a unique, embedded password hint that only they would be able to decipher.
Send files securely
Send encrypted files via email, Messages, AirDrop, Dropbox, carrier pigeon with USB stick — however you send them, your files are protected.
Crypto Tracker For Mac
Or save them to disk
With Encrypto, not only can you encrypt and share files, but you can also save them to your own disk. Select your files, put them through Encrypto, and voilà — they’re protected.
Don't take our word for it

Encrypto
Get your own private cryptographer
If you haven’t been living on Mars these last years, having a data encryption strategy is a must. Let Encrypto be part of it. It's easy to use and impossible to hack. Download and give it a spin right now.
Subscribe to know first

Thanks for signing up!
You’re almost done. Now, please check your email.
- All Implemented Interfaces:
Cloneable

A MAC provides a way to check the integrity of information transmitted over or stored in an unreliable medium, based on a secret key. Typically, message authentication codes are used between two parties that share a secret key in order to validate information transmitted between these parties.
Crypto For Money
A MAC mechanism that is based on cryptographic hash functions is referred to as HMAC. HMAC can be used with any cryptographic hash function, e.g., SHA256 or SHA384, in combination with a secret shared key. HMAC is specified in RFC 2104.
Every implementation of the Java platform is required to support the following standard Mac algorithms:

HmacSHA1HmacSHA256
- Since:
- 1.4
Constructor Summary
Constructors Modifier Constructor Description protectedMac(MacSpi macSpi,Provider provider,String algorithm)Method Summary
Modifier and Type Method Description Objectclone()Returns a clone if the provider implementation is cloneable.byte[]doFinal()byte[]doFinal(byte[] input)Processes the given array of bytes and finishes the MAC operation.voiddoFinal(byte[] output,int outOffset)StringgetAlgorithm()Returns the algorithm name of thisMacobject.static MacgetInstance(String algorithm)Returns aMacobject that implements the specified MAC algorithm.static MacgetInstance(String algorithm,String provider)Returns aMacobject that implements the specified MAC algorithm.static MacgetInstance(String algorithm,Provider provider)Returns aMacobject that implements the specified MAC algorithm.intgetMacLength()ProvidergetProvider()Returns the provider of thisMacobject.voidinit(Key key)voidinit(Key key,AlgorithmParameterSpec params)Initializes thisMacobject with the given key and algorithm parameters.voidreset()voidupdate(byte input)Processes the given byte.voidupdate(byte[] input)voidupdate(byte[] input,int offset,int len)Processes the firstlenbytes ininput, starting atoffsetinclusive.voidupdate(ByteBuffer input)Processesinput.remaining()bytes in the ByteBufferinput, starting atinput.position().Methods declared in class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Details
Mac
protectedMac(MacSpi macSpi,Provider provider,String algorithm)- Parameters:
macSpi- the delegateprovider- the provideralgorithm- the algorithm
Method Details
getAlgorithm
public finalStringgetAlgorithm()Returns the algorithm name of thisMacobject.This is the same name that was specified in one of the
getInstancecalls that created thisMacobject.- Returns:
- the algorithm name of this
Macobject.
getInstance
public static finalMacgetInstance(String algorithm) throws NoSuchAlgorithmExceptionReturns aMacobject that implements the specified MAC algorithm.This method traverses the list of registered security Providers, starting with the most preferred Provider. A new Mac object encapsulating the MacSpi implementation from the first Provider that supports the specified algorithm is returned.
Note that the list of registered providers may be retrieved via the
Security.getProviders()method.- Implementation Note:
- The JDK Reference Implementation additionally uses the
jdk.security.provider.preferredSecurityproperty to determine the preferred provider order for the specified algorithm. This may be different than the order of providers returned bySecurity.getProviders(). - Parameters:
algorithm- the standard name of the requested MAC algorithm. See the Mac section in the Java Security Standard Algorithm Names Specification for information about standard algorithm names.- Returns:
- the new
Macobject - Throws:
NoSuchAlgorithmException- if noProvidersupports aMacSpiimplementation for the specified algorithmNullPointerException- ifalgorithmisnull- See Also:
Provider
getInstance
public static finalMacgetInstance(String algorithm,String provider) throws NoSuchAlgorithmException,NoSuchProviderExceptionReturns aMacobject that implements the specified MAC algorithm.A new Mac object encapsulating the MacSpi implementation from the specified provider is returned. The specified provider must be registered in the security provider list.
Note that the list of registered providers may be retrieved via the
Security.getProviders()method.- Parameters:
algorithm- the standard name of the requested MAC algorithm. See the Mac section in the Java Security Standard Algorithm Names Specification for information about standard algorithm names.provider- the name of the provider.- Returns:
- the new
Macobject - Throws:
IllegalArgumentException- if theproviderisnullor emptyNoSuchAlgorithmException- if aMacSpiimplementation for the specified algorithm is not available from the specified providerNoSuchProviderException- if the specified provider is not registered in the security provider listNullPointerException- ifalgorithmisnull- See Also:
Provider
getInstance
public static finalMacgetInstance(String algorithm,Provider provider) throws NoSuchAlgorithmExceptionReturns aMacobject that implements the specified MAC algorithm.A new Mac object encapsulating the MacSpi implementation from the specified Provider object is returned. Note that the specified Provider object does not have to be registered in the provider list.
- Parameters:
algorithm- the standard name of the requested MAC algorithm. See the Mac section in the Java Security Standard Algorithm Names Specification for information about standard algorithm names.provider- the provider.- Returns:
- the new
Macobject - Throws:
IllegalArgumentException- if theproviderisnullNoSuchAlgorithmException- if aMacSpiimplementation for the specified algorithm is not available from the specifiedProviderobjectNullPointerException- ifalgorithmisnull- See Also:
Provider
getProvider
Returns the provider of thisMacobject.- Returns:
- the provider of this
Macobject.
getMacLength
Returns the length of the MAC in bytes.- Returns:
- the MAC length in bytes.
init
public finalvoidinit(Key key) throws InvalidKeyException- Parameters:
key- the key.- Throws:
InvalidKeyException- if the given key is inappropriate for initializing this MAC.
init
public finalvoidinit(Key key,AlgorithmParameterSpec params) throws InvalidKeyException,InvalidAlgorithmParameterExceptionInitializes thisMacobject with the given key and algorithm parameters.- Parameters:
key- the key.params- the algorithm parameters.- Throws:
InvalidKeyException- if the given key is inappropriate for initializing this MAC.InvalidAlgorithmParameterException- if the given algorithm parameters are inappropriate for this MAC.
update
public finalvoidupdate(byte input) throws IllegalStateException- Parameters:
input- the input byte to be processed.- Throws:
IllegalStateException- if thisMachas not been initialized.
update
public finalvoidupdate(byte[] input) throws IllegalStateException- Parameters:
input- the array of bytes to be processed.- Throws:
IllegalStateException- if thisMachas not been initialized.
update
public finalvoidupdate(byte[] input,int offset,int len) throws IllegalStateExceptionProcesses the firstlenbytes ininput, starting atoffsetinclusive.- Parameters:
input- the input buffer.offset- the offset ininputwhere the input starts.len- the number of bytes to process.- Throws:
IllegalStateException- if thisMachas not been initialized.
update
Processesinput.remaining()bytes in the ByteBufferinput, starting atinput.position(). Upon return, the buffer's position will be equal to its limit; its limit will not have changed.- Parameters:
input- the ByteBuffer- Throws:
IllegalStateException- if thisMachas not been initialized.- Since:
- 1.5
doFinal
public finalbyte[]doFinal() throws IllegalStateExceptionFinishes the MAC operation.A call to this method resets this
Macobject to the state it was in when previously initialized via a call toinit(Key)orinit(Key, AlgorithmParameterSpec). That is, the object is reset and available to generate another MAC from the same key, if desired, via new calls toupdateanddoFinal. (In order to reuse thisMacobject with a different key, it must be reinitialized via a call toinit(Key)orinit(Key, AlgorithmParameterSpec).- Returns:
- the MAC result.
- Throws:
IllegalStateException- if thisMachas not been initialized.
doFinal
public finalvoiddoFinal(byte[] output,int outOffset) throws ShortBufferException,IllegalStateExceptionFinishes the MAC operation.A call to this method resets this
Macobject to the state it was in when previously initialized via a call toinit(Key)orinit(Key, AlgorithmParameterSpec). That is, the object is reset and available to generate another MAC from the same key, if desired, via new calls toupdateanddoFinal. (In order to reuse thisMacobject with a different key, it must be reinitialized via a call toinit(Key)orinit(Key, AlgorithmParameterSpec).The MAC result is stored in
output, starting atoutOffsetinclusive.- Parameters:
output- the buffer where the MAC result is storedoutOffset- the offset inoutputwhere the MAC is stored- Throws:
ShortBufferException- if the given output buffer is too small to hold the resultIllegalStateException- if thisMachas not been initialized.
doFinal
public finalbyte[]doFinal(byte[] input) throws IllegalStateExceptionProcesses the given array of bytes and finishes the MAC operation.A call to this method resets this
Macobject to the state it was in when previously initialized via a call toinit(Key)orinit(Key, AlgorithmParameterSpec). That is, the object is reset and available to generate another MAC from the same key, if desired, via new calls toupdateanddoFinal. (In order to reuse thisMacobject with a different key, it must be reinitialized via a call toinit(Key)orinit(Key, AlgorithmParameterSpec).- Parameters:
input- data in bytes- Returns:
- the MAC result.
- Throws:
IllegalStateException- if thisMachas not been initialized.
reset
Resets thisMacobject.A call to this method resets this
Macobject to the state it was in when previously initialized via a call toinit(Key)orinit(Key, AlgorithmParameterSpec). That is, the object is reset and available to generate another MAC from the same key, if desired, via new calls toupdateanddoFinal. (In order to reuse thisMacobject with a different key, it must be reinitialized via a call toinit(Key)orinit(Key, AlgorithmParameterSpec).clone
public finalObjectclone() throws CloneNotSupportedExceptionReturns a clone if the provider implementation is cloneable.- Overrides:
clonein classObject- Returns:
- a clone if the provider implementation is cloneable.
- Throws:
CloneNotSupportedException- if this is called on a delegate that does not supportCloneable.- See Also:
Cloneable
