.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.plugins.hash_plugin Namespace Reference

Functions

 post_search (_request, search)
 

Variables

str name = "Hash plugin"
 
 description = gettext("Converts strings to different hash digests.")
 
bool default_on = True
 
str preference_section = 'query'
 
list query_keywords = ['md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512']
 
str query_examples = 'sha512 The quick brown fox jumps over the lazy dog'
 
 parser_re = re.compile('(md5|sha1|sha224|sha256|sha384|sha512) (.*)', re.I)
 

Function Documentation

◆ post_search()

searx.plugins.hash_plugin.post_search ( _request,
search )

Definition at line 19 of file hash_plugin.py.

19def post_search(_request, search):
20 # process only on first page
21 if search.search_query.pageno > 1:
22 return True
23 m = parser_re.match(search.search_query.query)
24 if not m:
25 # wrong query
26 return True
27
28 function, string = m.groups()
29 if not string.strip():
30 # end if the string is empty
31 return True
32
33 # select hash function
34 f = hashlib.new(function.lower())
35
36 # make digest from the given string
37 f.update(string.encode('utf-8').strip())
38 answer = function + " " + gettext('hash digest') + ": " + f.hexdigest()
39
40 # print result
41 search.result_container.answers.clear()
42 search.result_container.answers['hash'] = {'answer': answer}
43 return True

Variable Documentation

◆ default_on

bool searx.plugins.hash_plugin.default_on = True

Definition at line 11 of file hash_plugin.py.

◆ description

searx.plugins.hash_plugin.description = gettext("Converts strings to different hash digests.")

Definition at line 10 of file hash_plugin.py.

◆ name

str searx.plugins.hash_plugin.name = "Hash plugin"

Definition at line 9 of file hash_plugin.py.

◆ parser_re

searx.plugins.hash_plugin.parser_re = re.compile('(md5|sha1|sha224|sha256|sha384|sha512) (.*)', re.I)

Definition at line 16 of file hash_plugin.py.

◆ preference_section

str searx.plugins.hash_plugin.preference_section = 'query'

Definition at line 12 of file hash_plugin.py.

◆ query_examples

str searx.plugins.hash_plugin.query_examples = 'sha512 The quick brown fox jumps over the lazy dog'

Definition at line 14 of file hash_plugin.py.

◆ query_keywords

list searx.plugins.hash_plugin.query_keywords = ['md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512']

Definition at line 13 of file hash_plugin.py.