Created
March 4, 2012 20:37
-
-
Save awef/1974690 to your computer and use it in GitHub Desktop.
Chromeに「パッケージ化されていない拡張機能を読み込む」で拡張を読み込ませた時の拡張IDを算出
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 | |
# Google Chromeの「パッケージ化されていない拡張機能を読み込む」機能で拡張を | |
# ロードした時のIDを、拡張のディレクトリのパスから割り出す。 | |
# 参考: http://supercollider.dk/2010/01/calculating-chrome-extension-id-from-your-private-key-233 | |
def gen_id (path) | |
require "digest" | |
hash = Digest::SHA256.hexdigest(File.absolute_path(path)) | |
hash[0...32].tr("0-9a-f", "a-p") | |
end | |
print gen_id(ARGV[0] || gets.rstrip) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment