No commit activity in last 3 years
No release in over 3 years
Firefox/Waterfox/Pale Moon search engine hash generator
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

Firefox/Waterfox/Pale Moon Hash Generator

This library generates the hashes for firefox and derived browsers' search engine file. The hash is needed to programmatically set the default search engine.

Usage

require 'firefox_hash_generator'

FirefoxHashGenerator.generate(
  :firefox,
  'randombytes.default',
  'DuckDuckGo',
)

The first argument is the browser app name. This can be retrieved from the browser console by typing Services.appinfo.name for your browser. Note that the input control is disabled by default and is enabled by setting the about:config pref devtools.chrome.enabled to true.

The app name can be provided as a string or, for convenience, a symbol that maps the known browsers to their app names. Currently the following browsers are known:

  • :firefox
  • :pale_moon
  • :waterfox

The second parameter is the basename of the profile directory. It usually consists of a randomly generated string followed by the profile name.

The third parameter is the name of the search engine that is being set as the default one.

The entire process was copied from this amazing guide by Frederick Zhang.

To extract the JSON serialization of the search engine configuration from the search.json.mozlz4 file (which contains a proprietary header followed by the LZ4-compressed JSON), use a utility like lz4jsoncat or this Python code (which originated from this Python code). For Ruby, a working LZ4 compressor/decompressor is extlz4.

Bugs & Patches

Please report via issues and pull requests.

License

MIT