Last updated 2004-06-28 by Roedy
Green ©1996-2004 Canadian Mind Products
Java definitions: 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
You are here : home : Java Glossary : M words : MAC.
The MAC is useful as a unique computer indentifier for software protection schemes. Intel's Pentium class machines have a unique serial number burned into their silicon that can also serve that purpose. AMD's do not.
Here's how to display a long MAC address in hex with the traditional dashes.
/** * display a mac address in hex format: e.g. 00-60-6E-70-0D-A2 * @param 48-bit physical Ethernet Mac Address * @return string hex format dash-separated */ static public String macToString ( long mac ) { StringBuffer sb = new StringBuffer( 17 ); for ( int i=44; i>=0; i-=4 ) { int nibble = ((int)( mac >>> i )) & 0xf; char nibbleChar = (char)( nibble > 9 ? nibble + ('A'-10) : nibble + '0' ); sb.append( nibbleChar ); if ( (i & 0x7) == 0 && i != 0 ) { sb.append( '-' ); } } return sb.toString(); }
The code to extract the MAC in Windows is ugly, complicated, needs JNI and an extra iphlpapi library DLL not part of the normal Windows distribution. See this CodeGuru article. You can find out what it is with the IPCONFIG utility.
MAC also stands for Message Authentication Codes. They are digital signatures used to verify that a piece of data originated with a given party and that it has not been tampered with. 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., MD5 or SHA-1, in combination with a secret shared key. How HMACs work is specified in RFC 2104. JCE has support for HMAC-MD5 and HMAC-SHA1.
home |
Canadian Mind Products | |||
| mindprod.com IP:[24.87.56.253] | ||||
| Your IP:[80.134.30.163] | ||||
| You are visitor number 1704. | ||||
| Please send errors, omissions and suggestions | ||||
| to improve this page to Roedy Green. | ||||
| You can get a fresh copy of this page from: | or possibly from your local J: drive mirror: | |||
| http://mindprod.com/jgloss/mac.html | J:\mindprod\jgloss\mac.html | |||