Created
August 22, 2011 05:53
-
-
Save haruyama/1161756 to your computer and use it in GitHub Desktop.
this creates a table of macaddress, whose prefix(vendor id) is specified, to md5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# -*- encoding: utf-8 -*- | |
require 'digest/md5' | |
prefix = | |
begin | |
ARGV[0].downcase | |
rescue | |
'90840d' | |
end | |
def to_hex(i) | |
sprintf('%02x%02x%02x', i / 2**16, i / 2**8 % 2**8, i % 2**8) | |
end | |
(0...2**24).each { |i| | |
mac = prefix + to_hex(i) | |
print mac, "\t",Digest::MD5.new.update(mac),"\n" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment