Skip to content

Commit

Permalink
add mock files
Browse files Browse the repository at this point in the history
  • Loading branch information
james-garriss authored Feb 14, 2024
1 parent 523633b commit 68a014a
Show file tree
Hide file tree
Showing 13 changed files with 358 additions and 0 deletions.
23 changes: 23 additions & 0 deletions mock-db-connection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
namespace TestConnectionString
{
class Program
{
static void Main(string[] args)
{
using (SqlConnection conn = new SqlConnection("Server=localhost;Database=SQLShackDemo;User Id=SuperHero;Password=1pass;"))
{
conn.Open();
Console.WriteLine("Connection is just opened");
System.Threading.Thread.Sleep(10000);
conn.Close();
}
}
}

}
32 changes: 32 additions & 0 deletions mock-environment-variables.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Environment varialbes and secrets
# NOTE: You can reference secrets from a cloud secret manager by
# following this pattern: secret://[provider]/[resource]

# Google Cloud
# https://console.cloud.google.com/
GOOGLE_CLOUD_PROJECT=example
GOOGLE_CLOUD_REGION=us-central1

# Cloud Identity Platform (a.k.a. Firebase Auth)
# https://console.cloud.google.com/customer-identity
FIREBASE_APP_ID=1:674174690042:web:bb8d27dcc9e48fc0a7690d
FIREBASE_API_KEY=BIzbEyGBAlkrEIvlYgZeub9LBCkYJM6ySIMF2Je
FIREBASE_AUTH_DOMAIN=example.com

# Cloudflare
# https://dash.cloudflare.com/
CLOUDFLARE_ACCOUNT_ID=a8b47b39ab92525b2653229b28a1fc31
CLOUDFLARE_ZONE_ID=f3206a12cd93f45de116318496037c9f
CLOUDFLARE_API_TOKEN=secret://google/projects/example/secrets/cloudflare-api-token/versions/latest

# PostgreSQL Database
# https://www.postgresql.org/docs/current/libpq-envars.htm
PGHOST=34.172.75.101
PGPORT=5432
PGUSER=secret://google/projects/example/secrets/db-user/versions/latest
PGPASSWORD=secret://google/projects/example/secrets/db-password/versions/latest

# SendGrid
# https://app.sendgrid.com/settings/api_keys
EMAIL_FROM=[email protected]
SENDGRID_API_KEY=secrets://google/projects/example/secrets/sendgrid-api-key/versions/latest
26 changes: 26 additions & 0 deletions mock-google-api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<script src="https://apis.google.com/js/api.js"></script>
<script>
function start() {
// 2. Initialize the JavaScript client library.
gapi.client.init({
'apiKey': 'AIzaSy0c3965368a6b10f7640dbda46abfdca98',
// Your API key will be automatically added to the Discovery Document URLs.
'discoveryDocs': ['https://people.googleapis.com/$discovery/rest'],
// clientId and scope are optional if auth is not required.
'clientId': 'YOUR_WEB_CLIENT_ID.apps.googleusercontent.com',
'scope': 'profile',
}).then(function() {
// 3. Initialize and make the API request.
return gapi.client.people.people.get({
'resourceName': 'people/me',
'requestMask.includeField': 'person.names'
});
}).then(function(response) {
console.log(response.result);
}, function(reason) {
console.log('Error: ' + reason.result.error.message);
});
};
// 1. Load the JavaScript client library.
gapi.load('client', start);
</script>
11 changes: 11 additions & 0 deletions mock-google-oauth.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"installed": {
"client_id": "c151f93feb034ed7da85",
"project_id": "my-mock-project",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_secret": "0fd3f9942d1e65a267a5541ee1fc31d78d8aefda",
"redirect_uris": ["urn:ietf:wg:oauth:2.0:oob", "http://localhost"]
}
}
1 change: 1 addition & 0 deletions mock-jwt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTIzNDU2Nzg5LCJuYW1lIjoiSm9zZXBoIn0.OpOSSw7e485LOP5PrzScxHb7SR6sAOMRckfFwi4rp7o
12 changes: 12 additions & 0 deletions mock-jwt-2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.
eyJjbGllbnRfaWQiOiJZekV6TUdkb01ISm5PSEJpT0cxaWJEaHlOVEE9IiwicmVzcG9uc2Vf
dHlwZSI6ImNvZGUiLCJzY29wZSI6ImludHJvc2NwZWN0X3Rva2VucywgcmV2b2tlX3Rva2Vu
cyIsImlzcyI6ImJqaElSak0xY1hwYWEyMXpkV3RJU25wNmVqbE1iazQ0YlRsTlpqazNkWEU9
Iiwic3ViIjoiWXpFek1HZG9NSEpuT0hCaU9HMWliRGh5TlRBPSIsImF1ZCI6Imh0dHBzOi8v
bG9jYWxob3N0Ojg0NDMve3RpZH0ve2FpZH0vb2F1dGgyL2F1dGhvcml6ZSIsImp0aSI6IjE1
MTYyMzkwMjIiLCJleHAiOiIyMDIxLTA1LTE3VDA3OjA5OjQ4LjAwMCswNTQ1In0.
IxvaN4ER-PlPgLYzfRhk_JiY4VAow3GNjaK5rYCINFsEPa7VaYnRsaCmQVq8CTgddihEPPXe
t2laH8_c3WqxY4AeZO5eljwSCobCHzxYdOoFKbpNXIm7dqHg_5xpQz-YBJMiDM1ILOEsER8A
DyF4NC2sN0K_0t6xZLSAQIRrHvpGOrtYr5E-SllTWHWPmqCkX2BUZxoYNK2FWgQZpuUOD55H
fsvFXNVQa_5TFRDibi9LsT7Sd_az0iGB0TfAb0v3ZR0qnmgyp5pTeIeU5UqhtbgU9RnUCVmG
IK-SZYNvrlXgv9hiKAZGhLgeI8hO40utfT2YTYHgD2Aiufqo3RIbJA
27 changes: 27 additions & 0 deletions mock-rsa.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEA0pj32LapDxsvsOdgVWzkZMdp/k7R+KJhuXLUxFTuRQFlBDcc
mIPbkKzcJZO8pTXlRrqa4TiOLmdSM1AAW4cIX6xNYjO6V6Xx7wsXntg2YlYlN59e
lbaj08VY59XRwTDNqBnINUVGdJKy2qxe/NUf0+vtp9Fbms4aKYyoP6G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GBAJMmA/uaqzjU9b6zyzGjDYLRkiucPHjYiGIc
sddSrTRnDFnK/SMbYxFwftEqZ8Tqm2N6ZwViaZkbj7nd5+16mmcOyTOg+UErMHxl
aHE8kK4k62cq8XTb9Vu8/1NbxyIyT7UXNOCrHdwGrc5JGmVTVT2k1tXgoraJJ6wv
3SR1UmjZAoGARV26w6VMQKV0Y4ntnSIoGYWO9/15gSe2H3De+IPs4LyOP714Isi+
2JcO4QPvgRfd5I5FY6FTi7T0Gz2/DXHggv9DXM9Q2yXMhV+3tkTuNFeDwBw7qRGy
mCwOcAwHJ6GtCNvBDlpot6SauHEKKpzQobtq7giIEU3aSYR2unNg4wA=
-----END RSA PRIVATE KEY-----
1 change: 1 addition & 0 deletions mock-session-cookie
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[com.ibm.commerce.catalog.businesscontext.CatalogContext|null%26null%26false%26false%26false][com.ibm.commerce.context.base.BaseContext|10601%26%2d1002%26%2d1002%26%2d1][com.ibm.commerce.context.experiment.ExperimentContext|null]
122 changes: 122 additions & 0 deletions mock-session-key.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
var sessionKeys = require('../')
var test = require('tape')
var base64 = require('base64-js')

// ##########################################################################
// # WARNING : WARNING : WARNING : WARNING : WARNING : WARNING : WARNING
// # DO NOT CHANGE THE RESULT VALUES. THEY ARE USED BY MORE THAN ONE LIBRARY
// # AND THE OUTPUTS MUST BE CONSTANT TO ENSURE INTEROPERABILITY!
// #
// # IF THESE TESTS NO LONGER PASS THEN INTEROPERABILITY IS BROKEN!
// ##########################################################################

// INTERACTIVE

test('interactive test', function (t) {
sessionKeys.generate('[email protected]', 'pet sprain our trial patch bg', function (err, key) {
t.plan(7)

t.notOk(err, 'interactive no error')

t.equal(key.byteKeys.length, 8, 'interactive byteKeys length')
t.equal(key.hexKeys.length, 8, 'interactive hexKeys length')
t.equal(key.naclEncryptionKeyPairs.length, 8, 'interactive naclEncryptionKeyPairs length')
t.equal(key.naclEncryptionKeyPairsBase64.length, 8, 'interactive naclEncryptionKeyPairsBase64 length')
t.equal(key.naclSigningKeyPairs.length, 8, 'interactive naclSigningKeyPairs length')
t.equal(key.naclSigningKeyPairsBase64.length, 8, 'interactive naclSigningKeyPairsBase64 length')
})
})

test('interactive id test', function (t) {
sessionKeys.generate('[email protected]', 'pet sprain our trial patch bg', function (err, key) {
t.plan(2)

t.notOk(err, 'interactive id no error')

t.equals(key.id, 'b4c9a289323b21a01c3e940f150eb9b8c542587f1abfd8f0e1cc1ffc5e475514', 'interactive id')
})
})

test('interactive byteKeys test', function (t) {
sessionKeys.generate('[email protected]', 'pet sprain our trial patch bg', function (err, key) {
t.plan(2)

t.notOk(err, 'interactive byteKeys no error')

t.deepEqual(key.byteKeys,
[
new Uint8Array([227, 213, 226, 155, 22, 212, 112, 32, 60, 247, 86, 101, 125, 154, 151, 234, 71, 59, 82, 79, 8, 52, 188, 100, 91, 28, 165, 216, 183, 137, 157, 17]),
new Uint8Array([1, 37, 254, 86, 67, 74, 79, 174, 191, 132, 239, 255, 168, 102, 235, 106, 29, 219, 45, 47, 237, 108, 62, 205, 151, 27, 163, 160, 14, 0, 166, 54]),
new Uint8Array([81, 64, 179, 222, 199, 221, 82, 29, 93, 162, 162, 48, 44, 38, 209, 199, 21, 244, 64, 92, 47, 201, 177, 111, 93, 89, 82, 130, 203, 120, 135, 187]),
new Uint8Array([128, 57, 78, 134, 230, 191, 121, 88, 50, 177, 118, 75, 63, 231, 21, 168, 106, 103, 187, 78, 254, 58, 140, 198, 237, 3, 109, 126, 68, 60, 204, 216]),
new Uint8Array([125, 57, 175, 89, 168, 203, 202, 97, 200, 211, 78, 174, 118, 117, 162, 77, 206, 120, 124, 239, 76, 158, 219, 104, 27, 72, 253, 129, 100, 216, 68, 122]),
new Uint8Array([244, 123, 137, 212, 254, 81, 59, 36, 159, 247, 79, 163, 24, 189, 249, 58, 104, 13, 58, 174, 84, 236, 166, 53, 158, 251, 235, 160, 188, 44, 17, 35]),
new Uint8Array([70, 41, 248, 98, 4, 156, 146, 253, 236, 23, 38, 177, 1, 91, 139, 123, 15, 96, 53, 41, 168, 60, 244, 52, 89, 16, 219, 60, 29, 183, 32, 110]),
new Uint8Array([61, 52, 141, 115, 90, 229, 18, 231, 253, 192, 39, 20, 196, 222, 98, 126, 178, 56, 26, 30, 100, 75, 225, 191, 81, 74, 155, 41, 78, 19, 53, 97])
]
, 'interactive byteKeys')
})
})

test('interactive hexKeys test', function (t) {
sessionKeys.generate('[email protected]', 'pet sprain our trial patch bg', function (err, key) {
t.plan(2)

t.notOk(err, 'interactive hexKeys no error')

t.deepEqual(key.hexKeys,
[
'e3d5e29b16d470203cf756657d9a97ea473b524f0834bc645b1ca5d8b7899d11',
'0125fe56434a4faebf84efffa866eb6a1ddb2d2fed6c3ecd971ba3a00e00a636',
'5140b3dec7dd521d5da2a2302c26d1c715f4405c2fc9b16f5d595282cb7887bb',
'80394e86e6bf795832b1764b3fe715a86a67bb4efe3a8cc6ed036d7e443cccd8',
'7d39af59a8cbca61c8d34eae7675a24dce787cef4c9edb681b48fd8164d8447a',
'f47b89d4fe513b249ff74fa318bdf93a680d3aae54eca6359efbeba0bc2c1123',
'4629f862049c92fdec1726b1015b8b7b0f603529a83cf4345910db3c1db7206e',
'3d348d735ae512e7fdc02714c4de627eb2381a1e644be1bf514a9b294e133561'
]
, 'interactive hexKeys')
})
})

test('interactive naclEncryptionKeyPairsBase64 test', function (t) {
sessionKeys.generate('[email protected]', 'pet sprain our trial patch bg', function (err, key) {
t.plan(2)

t.notOk(err, 'interactive naclEncryptionKeyPairsBase64 no error')

t.deepEqual(key.naclEncryptionKeyPairsBase64,
[
{secretKey: '49XimxbUcCA891ZlfZqX6kc7Uk8INLxkWxyl2LeJnRE=', publicKey: '9G8XJgiIXj32stQmxtUa8vmmvLGTssTrEwd9tIYpVkA='},
{secretKey: 'ASX+VkNKT66/hO//qGbrah3bLS/tbD7NlxujoA4ApjY=', publicKey: 'JH73SmhYv43j25rpC8q797XHQi4hx/DrAcQCb5i143k='},
{secretKey: 'UUCz3sfdUh1doqIwLCbRxxX0QFwvybFvXVlSgst4h7s=', publicKey: 'HmpoJqIjMnHYqvQheiCc8HXymyiGHX3ell8A+2WE330='},
{secretKey: 'gDlOhua/eVgysXZLP+cVqGpnu07+OozG7QNtfkQ8zNg=', publicKey: 'otEJhqs+cpZ1x4OHva30k4T8ye7x5eUBc2UR5IcZkhc='},
{secretKey: 'fTmvWajLymHI006udnWiTc54fO9MnttoG0j9gWTYRHo=', publicKey: 'AHHyBuknbD8/2sOe5fUWY7y9zVkOD1SrjaLdBRglVDM='},
{secretKey: '9HuJ1P5ROySf90+jGL35OmgNOq5U7KY1nvvroLwsESM=', publicKey: 'uFKZeT1VgkltnczCmljitEQswPFjQT2mS6nRKAJ4YnE='},
{secretKey: 'Rin4YgSckv3sFyaxAVuLew9gNSmoPPQ0WRDbPB23IG4=', publicKey: 'W/VA/NmgV4idPxVtzuGE8Uo5bs2fQU0L2cxhoZJFgyU='},
{secretKey: 'PTSNc1rlEuf9wCcUxN5ifrI4Gh5kS+G/UUqbKU4TNWE=', publicKey: 'zyQcH+swlgDiBwzDAtFnTMKWR//DdNPyFYNLLMOLsjc='}
]
, 'interactive naclEncryptionKeyPairsBase64')
})
})

test('interactive naclSigningKeyPairsBase64 test', function (t) {
sessionKeys.generate('[email protected]', 'pet sprain our trial patch bg', function (err, key) {
t.plan(9)

t.notOk(err, 'interactive naclSigningKeyPairsBase64 no error')

// NOTE : Test only the public (verify) key against the Ruby gem output.
// RbNaCl and tweetnacl-js somehow have different private key values,
// but the same public key values. This is OK, since the private
// key is never shared.
t.equals(key.naclSigningKeyPairsBase64[0]['publicKey'], '9mc6TmR6fw+OfPZA+TI4pDMeensYo3vHjCAWwNJr5Sg=', 'public key 0')
t.equals(key.naclSigningKeyPairsBase64[1]['publicKey'], 'IA4yoeU/2xv2elvmJWFLP3Hiy2Hp5FdGpdrJjkf+5FU=', 'public key 1')
t.equals(key.naclSigningKeyPairsBase64[2]['publicKey'], '/orhEpXoWrbHQcWlg/IEnNiJvW+2j0lS7+/gvOFlppc=', 'public key 2')
t.equals(key.naclSigningKeyPairsBase64[3]['publicKey'], 'JAr8Pcij0HTvraNF9UeZ3vx0rvtixv4aIIMuDXrq+xc=', 'public key 3')
t.equals(key.naclSigningKeyPairsBase64[4]['publicKey'], 'j9v+uOiZ2iVYwIiSMEeh8LVtFVagKkQ0n8lM6g7NIEY=', 'public key 4')
t.equals(key.naclSigningKeyPairsBase64[5]['publicKey'], 'SJF1MvZ0Ggb1UQWHKkn9NHAkHU9A/ofV159fCsB6Pbo=', 'public key 5')
t.equals(key.naclSigningKeyPairsBase64[6]['publicKey'], 'KlYHO13rFU3vlWxHvMo0s7nILVH6rzsgDAblSz3yVaw=', 'public key 6')
t.equals(key.naclSigningKeyPairsBase64[7]['publicKey'], 'HllzWBHwzXC4XnQU0xSzGDYN5aUhD2lbSQJVF3f2mQA=', 'public key 7')
})
})
38 changes: 38 additions & 0 deletions mock-ssh-key
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
NhAAAAAwEAAQAAAYEAr6ZIHpmiVdH4F8rDtMH6JGXwToCnHVTXfR/rzzLbmKvfsF+G+Iwb
LUNlNeO45iOSlg6aYgOVEd8h+AbCCiSFvxAb5/XlseGADa4g2nvKjNqxfOzvJyerCY1woa
Gz3LXuAg05R5ajz1SHsLOrlL7qj9S4fdxPB2y43j9lubYooEcrDrv8A8j9wAdzHPH7rZDD
Y7fyDSEA+j1hrz9hLHOzPyyUI9ZwdaqdjMeRyCFWzgrynL7vfu1aj+ZL217xeLR99t1Wx8
vi9COKoCMx6Aj+dSUuGJQ4JDHvrbV+zG/LE6iTSqZnZ9/jpu5UmXWySM7TBrpw6EEEP9Ki
W9GaRq0J9NAsWjUYsQYURjJh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BINNlDIUTokvcTZ1QuoPb2NzRS83sHr
0lMQeWEmRU73qwa4P+zpYKg8qIKXBnYybkLIrsFY45cpSlvBFFLLAI4GoFTOpmcjr5OP5g
WPFNdmpSShgotWjxPelJ0leiaxeWFNmGWaO2sz5aMR5yopcQc75dtBxsPSUs5YlzB9AAAA
wFmwHYk03Y3VS0Hw5Jv9gfhygDwvOcOV3O6JZP99AKEqQm3vzV5CtE1Fzi5XeWQskNE9+Q
4Hvhhqslia5xZmgnz4J+jWSMngrDHweltkfZr1T1GTKTslL0wQulIFdDjXf4o+v6tQw+7c
lgIe/yl/yot45mN/i4LLM5Tvb6PiXPdz7K68dZxBjHMOf8UG51KZINZJRHkDyYh5tP2UoF
MfjWP6/9tOil8Al0uOZjA6IbYbY0hnAhoBe5lNXJrjjIDBjAAAAMEA2qKcSjRkaTOEIFJc
M6rE2Y3XuiRVIB/WSarQS/3ezRyN3k9NFAQYzFix2bJuqXb/nPaGe3+Cd9rDaG9aJRWyZv
/UsmovkWYdSUqOIHcCsVMwpjBOZYASsMc+HZunGPdypkf5E8MEIFRMiDc7JXb2JbMpbNuE
ocq/tQ1DVwl2KQg4q+tXolDFjy78d9LMkRrI6ZrdjDYETVU1n/shnocJSmTzIc8/V/OxxW
Dw1Cd3KtRQnRU54lytoAamYdJgjG5nAAAAwQDNqwdudQ1hxY6acovCSlrcG2lrcr1PEPww
eGeyfc4LQaTKewgC5vIBkX6filwjc3Kh2kmpsrzMkCl25Rx475PjXoVkdYmjlX8AWhVvwe
guKBiuQwPNLq40POxbBZl9b/lEy5vJOPxjS3SY6hPOpc9FgGdIoknT3kc/zmyY4E6vS0+x
rLQhOJfh1fR6/D0k49xqI1JjrHIPelJ1B5g4vxfBIrSpxreUMlXAwXUgp18cQqMLimroZZ
JBp03zhqSXS/sAAAAUamdhcnJpc3NATU0yODkyNDMtUEMBAgMEBQYH
-----END OPENSSH PRIVATE KEY-----
1 change: 1 addition & 0 deletions mock-ssh-key.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCvpkgemaJV0fgXysO0wfokZfBOgKcdVNd9H+vPMtuYq9+wX4b4jBstQ2U147jmI5KWDppiA5UR3yH4BsIKJIW/EBvn9eWx4YANriDae8qM2rF87O8nJ6sJjXChobPcte4CDTlHlqPPVIews6uUvuqP1Lh93E8HbLjeP2W5tiigRysOu/wDyP3AB3Mc8futkMNjt/INIQD6PWGvP2Esc7M/LJQj1nB1qp2Mx5HIIVbOCvKcvu9+7VqP5kvbXvF4tH323VbHy+L0I4qgIzHoCP51JS4YlDgkMe+ttX7Mb8sTqJNKpmdn3+Om7lSZdbJIztMGunDoQQQ/0qJb0ZpGrQn00CxaNRixBhRGMmFBqh5tQZCc+3+vJRAJkKinCI2qyPvxl9xQS9a3EO/FHtF62uP/dcuSndvymsdKWEzXMqoB9y64bAdH6NMfpFPNfXJ6i9DudJRCvypJz8uyjUr2WN3cnXPq63JM+VUn3DDXMhDvGZDMZHuZ2PLU+QQEBujJa/0= jgarriss@MM289243-PC
31 changes: 31 additions & 0 deletions mock-username-password.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include <iostream>
#include <string>

using namespace std; //introduces namespace std
int main( void )
{
int password;
password = 1234;

string username;
username = 'Raymond';
string userinput;

do
{
cout << "Enter username:";
cin >> userinput;
if (userinput == username);
{
cout <<"\n";
cout << "Enter password:";
cin >> password;
}
}
while (userinput == username);
if (password == 1234)
cout << "Access Granted...";
if (password != 1234)
cout << "Access Denied.....Invalid Username/Password:";
return 0;
}
33 changes: 33 additions & 0 deletions mock-username-password.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from hashlib import md5
from getpass import getpass
import sys

print("Hello! Welcome to FaceSnap!")

attempts = 0
check_username = "5945261a168e06a5b763cc5f4908b6b2"
check_password = "48d6215903dff56238e52e8891380c8f"
# These hashes have been generated earlier on.
# This is not how you would go about storing usernames and passwords,
# but for the sake of simplicity, we'll do it like this.

while True:
username = input("Username: ")
password = getpass("Password: ")
# Getpass will not echo input to the screen, so your password remains
# invisible
print()

if attempts == 3:
sys.exit("Too many failed attempts.")

if md5(username.encode().hexdigest()) == check_username:
if md5(password.encode().hexdigest()) == check_password:
print("Username and password entered correctly.")
# Username and password match - do something here
else:
print("Password entered incorrectly.")
attempts += 1
else:
print("Username entered incorrectly.")
attempts += 1

0 comments on commit 68a014a

Please sign in to comment.