-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.lua.save
More file actions
35 lines (27 loc) · 919 Bytes
/
test.lua.save
File metadata and controls
35 lines (27 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
local encrypt = require("pure-encrypt")
print(encrypt)
local hashing = require("pure-encrypt.hashing")
local salting = require("pure-encrypt.salting")
local verify = require("pure-encrypt.verify")
local password = "Hello, World!"
local salt = salting.generate_salt()
local hash = hashing.sha256_Hashing(salt .. password)
print("Salt: " .. salt)
print("Hash: " .. hash)
local is_valid = verify.verify(salt, password, hash)
if is_valid then
print("Password is correct")
print("Correct password test passed successfully")
else
print("Password is incorrect")
print("Correct password test failed")
end
local wrong_password = "Wrong Password"
local is_valid_wrong = verify.verify(salt, wrong_password, hash)
if is_valid_wrong then
print("Password is correct")
print("Wrong password test failed")
else
print("Password is incorrect")
print("Wrong password test passed successfully")
end