Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate the appID for a Google Chrome Extension [duplicate]

Possible Duplicate:
Google Chrome - Alphanumeric hashes to identify extensions

I'm building a Chrome extension packager, and am trying to figure out how to programmatically generate the appID from the package contents.

The appID is a 32-byte string consisting of lower-case letters, like these:

extension page screenshot

According to the Chrome extension documentation, the appID is "generated based on a hash of the extension's public key," and is used to uniquely identify an extension.

Since I'd like to be able to package an extension without using the Chrome GUI, and the public key is already included in the package contents, can anyone tell me how these are generated?

like image 392
Jed Schmidt Avatar asked Jan 18 '23 13:01

Jed Schmidt


1 Answers

It is SHA256 of the public key encoded into string in a special way:

http://codesearch.google.com/#OAMlx_jo-ck/src/chrome/browser/extensions/extension_service.cc&exact_package=chromium&q=Extension::GenerateId&type=cs&l=1200

http://codesearch.google.com/#OAMlx_jo-ck/src/chrome/common/extensions/extension.cc&exact_package=chromium&q=GenerateId&type=cs&l=375

like image 123
Vyacheslav Egorov Avatar answered Feb 16 '23 02:02

Vyacheslav Egorov