ItsDangerous Documentation (1.1.x)
Release 1.1.0signer.Signer(secret_key, salt=None, sep=’.’, key_derivation=None, di- gest_method=None, algorithm=None) This class can sign and unsign bytes, validating the signature provided. Salt can be used to namespace or re-using a salt value across different parts of your application where the same signed value in one part can mean something different in another part is a security risk. See The Salt for an example example of what the salt is doing and how you can utilize it. New in version 0.18: algorithm was added as an argument to the class constructor. New in version 0.14: key_derivation and digest_method were added0 码力 | 28 页 | 178.96 KB | 1 年前3
Django 3.0.x Documentationdefault. The password attribute of a User object is a string in this format:$ $<salt>$ Those are the components used for storing a User’s password, separated by the dollar-sign and consist of: the hashing algorithm, the number of algorithm iterations (work factor), the random salt, and the resulting password hash. The algorithm is one of a number of one-way hashing or password Django can use; see below. Iterations describe the number of times the algorithm is run over the hash. Salt is the random seed used and the hash is the result of the one- way function. By default, Django uses 0 码力 | 3085 页 | 2.95 MB | 1 年前3
peewee Documentation Release 2.10.2db') def get_hexdigest(salt, raw_password): data = salt + raw_password return sha1(data.encode('utf8')).hexdigest() @db.func() def make_password(raw_password): salt = get_hexdigest(str(random()) get_hexdigest(salt, raw_password) return '%s$%s' % (salt, hsh) @db.func() def check_password(raw_password, enc_password): salt, hsh = enc_password.split('$', 1) return hsh == get_hexdigest(salt, raw_password)0 码力 | 275 页 | 276.96 KB | 1 年前3
peewee Documentation
Release 2.10.2blog.db') def get_hexdigest(salt, raw_password): data = salt + raw_password return sha1(data.encode('utf8')).hexdigest() @db.func() def make_password(raw_password): salt = get_hexdigest(str(random()) = get_hexdigest(salt, raw_password) return '%s$%s' % (salt, hsh) 1.15. Hacks 207 peewee Documentation, Release 2.10.2 @db.func() def check_password(raw_password, enc_password): salt, hsh = enc_password enc_password.split('$', 1) return hsh == get_hexdigest(salt, raw_password) Here is how you can use the function to add a new user, storing a hashed password: query = User.insert( username='charlie', password=fn0 码力 | 221 页 | 844.06 KB | 1 年前3
peewee Documentation Release 3.0.0db') def get_hexdigest(salt, raw_password): data = salt + raw_password return sha1(data.encode('utf8')).hexdigest() @db.func() def make_password(raw_password): salt = get_hexdigest(str(random()) get_hexdigest(salt, raw_password) return '%s$%s' % (salt, hsh) @db.func() def check_password(raw_password, enc_password): salt, hsh = enc_password.split('$', 1) return hsh == get_hexdigest(salt, raw_password)0 码力 | 319 页 | 361.50 KB | 1 年前3
peewee Documentation
Release 3.5.0db') def get_hexdigest(salt, raw_password): data = salt + raw_password return sha1(data.encode('utf8')).hexdigest() @db.func() def make_password(raw_password): salt = get_hexdigest(str(random()) get_hexdigest(salt, raw_password) return '%s$%s' % (salt, hsh) @db.func() def check_password(raw_password, enc_password): salt, hsh = enc_password.split('$', 1) return hsh == get_hexdigest(salt, raw_password)0 码力 | 347 页 | 380.80 KB | 1 年前3
peewee Documentation Release 3.4.0db') def get_hexdigest(salt, raw_password): data = salt + raw_password return sha1(data.encode('utf8')).hexdigest() @db.func() def make_password(raw_password): salt = get_hexdigest(str(random()) get_hexdigest(salt, raw_password) return '%s$%s' % (salt, hsh) @db.func() def check_password(raw_password, enc_password): salt, hsh = enc_password.split('$', 1) return hsh == get_hexdigest(salt, raw_password)0 码力 | 349 页 | 382.34 KB | 1 年前3
peewee Documentation Release 3.1.0db') def get_hexdigest(salt, raw_password): data = salt + raw_password return sha1(data.encode('utf8')).hexdigest() @db.func() def make_password(raw_password): salt = get_hexdigest(str(random()) get_hexdigest(salt, raw_password) return '%s$%s' % (salt, hsh) @db.func() def check_password(raw_password, enc_password): salt, hsh = enc_password.split('$', 1) return hsh == get_hexdigest(salt, raw_password)0 码力 | 332 页 | 370.77 KB | 1 年前3
peewee Documentation
Release 3.5.0blog.db') def get_hexdigest(salt, raw_password): data = salt + raw_password return sha1(data.encode('utf8')).hexdigest() @db.func() def make_password(raw_password): salt = get_hexdigest(str(random()) get_hexdigest(salt, raw_password) return '%s$%s' % (salt, hsh) @db.func() def check_password(raw_password, enc_password): salt, hsh = enc_password.split('$', 1) return hsh == get_hexdigest(salt, raw_password)0 码力 | 282 页 | 1.02 MB | 1 年前3
peewee Documentation
Release 3.3.0blog.db') def get_hexdigest(salt, raw_password): data = salt + raw_password return sha1(data.encode('utf8')).hexdigest() @db.func() def make_password(raw_password): salt = get_hexdigest(str(random()) get_hexdigest(salt, raw_password) return '%s$%s' % (salt, hsh) @db.func() def check_password(raw_password, enc_password): salt, hsh = enc_password.split('$', 1) return hsh == get_hexdigest(salt, raw_password)0 码力 | 280 页 | 1.02 MB | 1 年前3
共 190 条
- 1
- 2
- 3
- 4
- 5
- 6
- 19













