# Path: scrypture/webapi.py
# class WebAPI(flask_wtf.Form):
# class PassHTTPAuthorizationHeader(requests.auth.AuthBase):
# def text_input(*args, **kwargs):
# def list_input(*args, **kwargs):
# def line_input(*args, **kwargs):
# def password_input(*args, **kwargs):
# def radio_field(*args, **kwargs):
# def submit_button(*args, **kwargs):
# def multiple_input(*args, **kwargs):
# def checkbox_field(*args, **kwargs):
# def file_field(*args, **kwargs):
#     def __init__(self, header):
#     def __call__(self, r):


import os
import hashlib
from scrypture import webapi
#!/usr/bin/env python
# module_template.py
"""
Simple hash functions run on an uploaded file
"""

from __future__ import print_function

def hash(hash_type, input_text):
    '''Hash input_text with the algorithm choice'''
    hash_funcs = {'MD5' : hashlib.md5,
                  'SHA1' : hashlib.sha1,
                  'SHA224' : hashlib.sha224,
                  'SHA256' : hashlib.sha256,
                  'SHA384' : hashlib.sha384,
                  'SHA512' : hashlib.sha512}
    if hash_type == 'All':
        hash_type = ['MD5', 'SHA1', 'SHA224', 'SHA256', 'SHA384', 'SHA512']
    else:
        hash_type = [hash_type]
    return [{'Algorithm' : h, 'Hash' : hash_funcs[h](input_text).hexdigest()}
            for h in hash_type]


### WebAPI ###


# Path: scrypture/webapi.py
# class WebAPI(flask_wtf.Form):
# class PassHTTPAuthorizationHeader(requests.auth.AuthBase):
# def text_input(*args, **kwargs):
# def list_input(*args, **kwargs):
# def line_input(*args, **kwargs):
# def password_input(*args, **kwargs):
# def radio_field(*args, **kwargs):
# def submit_button(*args, **kwargs):
# def multiple_input(*args, **kwargs):
# def checkbox_field(*args, **kwargs):
# def file_field(*args, **kwargs):
#     def __init__(self, header):
#     def __call__(self, r):


# Path: scrypture/demo_scripts/Security/file_hash.py
import os
import hashlib
from scrypture import webapi

#!/usr/bin/env python
# module_template.py
"""
Simple hash functions run on an uploaded file
"""

from __future__ import print_function

def hash(hash_type, input_text):
    '''Hash input_text with the algorithm choice'''
    hash_funcs = {'MD5' : hashlib.md5,
                  'SHA1' : hashlib.sha1,
                  'SHA224' : hashlib.sha224,
                  'SHA256' : hashlib.sha256,
                  'SHA384' : hashlib.sha384,
                  'SHA512' : hashlib.sha512}
    if hash_type == 'All':
        hash_type = ['MD5', 'SHA1', 'SHA224', 'SHA256', 'SHA384', 'SHA512']
    else:
        hash_type = [hash_type]
    return [{'Algorithm' : h, 'Hash' : hash_funcs[h](input_text).hexdigest()}
            for h in hash_type]


### WebAPI ###


class WebAPI(webapi.WebAPI):