Ejemplo n.º 1
0
def main(argv):
    if (len(argv)<2):
        print("Implementation tests")
        print("-----------------------------------------------------------------")
        info=opencl_information()
        info.printplatforms()
        print("\nPlease run as: python test.py [platform number]")
        return

    # Input values to be hashed
    passwordlist = [b'password', b'hmm', b'trolololl', b'madness']
    salt = b"salty"
    
    platform = int(argv[1])
    debug = 0
    write_combined_file = False
    opencl_algos = opencl.opencl_algos(platform, debug, write_combined_file,inv_memory_density=1)
    # Call the tests

    md5_test(opencl_algos,passwordlist)
    sha256_test(opencl_algos,passwordlist)
    sha1_test(opencl_algos,passwordlist)

    md5_hmac_test(opencl_algos, passwordlist, salt)
    sha1_hmac_test(opencl_algos, passwordlist, salt)
    sha256_hmac_test(opencl_algos, passwordlist, salt)
    
    pbkdf2_hmac_md5_test(opencl_algos, passwordlist, salt, 1000, 50)
    pbkdf2_hmac_sha1_test(opencl_algos, passwordlist, salt, 1000, 50)
    pbkdf2_hmac_sha256_test(opencl_algos, passwordlist, salt, 1000, 50)
    
    scrypt_test(opencl_algos,passwordlist,15,3,1,0x20,salt)

    print("Tests have finished.")
Ejemplo n.º 2
0
def main(argv):
    if len(argv) < 2:
        print("Implementation tests")
        print("-----------------------------------------------------------------")
        info = opencl_information()
        info.printplatforms()
        print("\nPlease run as: python test.py [platform number]")
        return

    # Input values to be hashed
    passwordlist = [b'password', b'hmm', b'trolololl', b'madness']
    salts = [b"salty123", b"salty12",b"\xd1\x0c\x00\xd2\xfe\x64\x02\x98",b"\x12\x34\x56\x78"]

    platform = int(argv[1])
    debug = 0
    write_combined_file = False
    opencl_algos = opencl.opencl_algos(platform, debug, write_combined_file, inv_memory_density=1)
    # Call the tests

    for salt in salts:
        print("Using salt: %s" % salt)
        md5_test(opencl_algos, passwordlist)
        md5_hmac_test(opencl_algos, passwordlist, salt)
        pbkdf2_hmac_md5_test(opencl_algos, passwordlist, salt, 1000, 32)
        pbkdf2_hmac_md5_test(opencl_algos, passwordlist, salt, 1000, 50)
        hash_iterations_md5_test(opencl_algos, passwordlist, 10000)
        
        sha1_test(opencl_algos, passwordlist)
        sha1_hmac_test(opencl_algos, passwordlist, salt)
        pbkdf2_hmac_sha1_test(opencl_algos, passwordlist, 16*b"\x00", 1000, 32)
        pbkdf2_hmac_sha1_test(opencl_algos, passwordlist, salt, 1000, 32)
        pbkdf2_hmac_sha1_test(opencl_algos, passwordlist, salt, 1000, 64)
        hash_iterations_sha1_test(opencl_algos, passwordlist, 10000)

        sha256_test(opencl_algos, passwordlist)
        sha256_hmac_test(opencl_algos, passwordlist, salt)
        pbkdf2_hmac_sha256_test(opencl_algos, passwordlist, salt, 10000, 32)
        pbkdf2_hmac_sha256_test(opencl_algos, passwordlist, salt, 10000, 50)
        hash_iterations_sha256_test(opencl_algos, passwordlist, 10000)

        sha512_test(opencl_algos, passwordlist)
        sha512_hmac_test(opencl_algos, passwordlist, salt)
        pbkdf2_hmac_sha512_test(opencl_algos, passwordlist, salt, 1000, 32)
        pbkdf2_hmac_sha512_test(opencl_algos, passwordlist, salt, 1000, 50)
        hash_iterations_sha512_test(opencl_algos, passwordlist, 10000)

        scrypt_test(opencl_algos, passwordlist, 15, 3, 1, 0x20, salt)

    """
    from time import perf_counter
    start=perf_counter()
    for i in range(200000):
        passwordlist.append(b"test%04d" % i)
    pbkdf2_hmac_sha256_speedtest(opencl_algos,passwordlist,salts[0],1000,50)
    end=perf_counter()
    print("Time: %f" % (end-start))
    """
    print("Tests have finished.")
Ejemplo n.º 3
0
def main(argv):
    if (len(argv) < 2):
        print("Implementation tests")
        print(
            "-----------------------------------------------------------------"
        )
        info = opencl_information()
        info.printplatforms()
        print("\nPlease run as: python test.py [platform number]")
        return

    passwordlist = []

    # Input values to be hashed
    print("\nGenearating strings")
    for i in range(1):
        print("\nGenearated", i, "strings")
        passwordlist.append(str.encode(get_random_string(1048576)))
    #salts = [b"salty123",b"salty12"]

    platform = int(argv[1])
    debug = 0
    write_combined_file = False
    opencl_algos = opencl.opencl_algos(platform,
                                       debug,
                                       write_combined_file,
                                       inv_memory_density=1)
    # Call the tests

    print("opencl gpu test sha512")
    hash_iterations_sha512_test(opencl_algos, passwordlist, 1000000)
    '''
    for salt in salts:
        print("Using salt: %s" % salt)
        #hash_iterations_md5_test(opencl_algos, passwordlist, 10000)
        #hash_iterations_sha1_test(opencl_algos, passwordlist, 10000)
        #hash_iterations_sha256_test(opencl_algos, passwordlist, 10000)
        start = time.time()
        hash_iterations_sha512_test(opencl_algos, passwordlist, 10000)
        done = time.time()
        elapsed = done - start
        print("time used", elapsed)
    '''

    print("Tests have finished.")
Ejemplo n.º 4
0
def main(argv):
    info = opencl_information()
    if (len(argv) < 4):
        print("Implementation tests")
        print(
            "-----------------------------------------------------------------"
        )
        info.printplatforms()
        print(
            "\nPlease run as: python test.py [platform number] [number of passwords] [number of salts]"
        )
        return

    info.printfullinfo()

    passwords_count = int(argv[2])
    salts_count = int(argv[3])

    # Input values to be hashed
    t0 = time.time()
    passwordlist = list(random_string_generator(passwords_count))
    salts = list(random_string_generator(salts_count))
    t1 = time.time()
    print("%d random passwords and salts were generated in: %.6f\n" %
          ((passwords_count + salts_count), (t1 - t0)))

    platform = int(argv[1])
    debug = 1
    write_combined_file = False
    opencl_algos = opencl.opencl_algos(platform,
                                       debug,
                                       write_combined_file,
                                       inv_memory_density=1)
    # Call the tests

    for salt in salts:
        print("Using salt: %s" % salt)
        scrypt_test(opencl_algos, passwordlist, 14, 3, 3, 0x20, salt)
        print()

    print("Tests have finished.")
Ejemplo n.º 5
0
				sys.exit()
			elif not (args.min is None or args.max is None) and not args.mask is None:
				print(f"{Fore.RED}Valorizzare o minima e massima lunghezza password o la sua maschera")
				sys.exit()
			if args.min is not None: minp=args.min 
			if args.max is not None: maxp=args.max 
			if args.mask is not None: mask=args.mask
		elif args.mode=="dict" and args.filedic is None:
			print(f"{Fore.RED} Valorizzare il parametro dizionario")
			sys.exit()
		else:
			filedic=args.filedic
		
		if args.plat is not None: 
			if  args.plat=="?":
				info=opencl_information()
				info.printplatforms()
				sys.exit()
			else:
				plat=args.plat
		if args.block is not None: block=args.block
		
		if args.json is not None:
			jsnf=args.json
		if args.proc is not None:
			proc=args.proc
		with open(jsnf) as f:
			dictk=json.load(f)
		
		oki=create_class_okeys(dictk) #create class with methods to decode
		start_search( oki,  \