Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from django.template import RequestContext
- from django.http import HttpResponseRedirect, HttpResponse
- import json
- from django.shortcuts import *
- import hashlib
- def ld45_tpl(request):
- return render_to_response("web/ld45.html",context_instance=RequestContext(request))
- def ld45(request):
- for_return ={
- "info_function":"ld45",
- "result":"Not POST ?",
- }
- if request.method == "POST":
- def to_hash(line,ch):
- line = line.encode('utf-8')
- types = {
- "md5":hashlib.md5,
- "sha512":hashlib.sha512,
- "sha224":hashlib.sha224,
- "sha1":hashlib.sha1
- }
- m = types[ch]()
- m.update(line)
- return m.hexdigest()
- for_return["result"]=to_hash(request.POST["srt_to_md5"],request.POST["ch"])
- return HttpResponse(json.dumps(for_return), mimetype='application/json')
Advertisement
Add Comment
Please, Sign In to add comment