Python IPython.lib.passwd() Examples

The following are 4 code examples of IPython.lib.passwd(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module IPython.lib , or try the search function .
Example #1
Source File: server_app.py    From ipynb-docker with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def server(first_name):
    global port
    pw = ''
    for i in range(8):
        pw += random.choice(charset)
    pws = passwd(pw)
    os.system("sudo docker run -d -t -e 'PW=%s' -e 'PORT=%d' -p %d:%d -m 500m jupserver" 
			% (pws, port, port, port))
    return render_template('server.html', first_name=first_name, port=port, pw=pw) 
Example #2
Source File: test_security.py    From Computable with MIT License 5 votes vote down vote up
def test_passwd_structure():
    p = passwd('passphrase')
    algorithm, salt, hashed = p.split(':')
    nt.assert_equal(algorithm, 'sha1')
    nt.assert_equal(len(salt), salt_len)
    nt.assert_equal(len(hashed), 40) 
Example #3
Source File: test_security.py    From Computable with MIT License 5 votes vote down vote up
def test_roundtrip():
    p = passwd('passphrase')
    nt.assert_equal(passwd_check(p, 'passphrase'), True) 
Example #4
Source File: test_security.py    From Computable with MIT License 5 votes vote down vote up
def test_bad():
    p = passwd('passphrase')
    nt.assert_equal(passwd_check(p, p), False)
    nt.assert_equal(passwd_check(p, 'a:b:c:d'), False)
    nt.assert_equal(passwd_check(p, 'a:b'), False)