[issue33213] crypt function not hashing properly on Mac (uses a specific salt)

2021-06-20 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Actually it should be:

  if method is not None and method not in methods:
...

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33213] crypt function not hashing properly on Mac (uses a specific salt)

2021-06-20 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

How about adding a check to `crypt.mksalt()`:

if method and method not in methods:
raise ValueError(f'method {method} is not supported')

If a method is supplied to `crypt.crypt()`, mksalt() is called with it as an 
arg, so adding this check will take care of both paths:
crypt(val, method)
crypt(val, mksalt(method))

the only remaining issue is if an (improperly generated) salt is loaded
from somewhere and used to call `crypt()`, but the check above fixes most of 
the issue.

I can put up a PR if this sounds good.

--
nosy: +andrei.avk

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33213] crypt function not hashing properly on Mac (uses a specific salt)

2021-05-25 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy:  -mark.dickinson

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33213] crypt function not hashing properly on Mac (uses a specific salt)

2021-05-21 Thread Ned Deily


Change by Ned Deily :


--
components: +macOS
versions: +Python 3.11 -Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33213] crypt function not hashing properly on Mac (uses a specific salt)

2018-04-07 Thread Ron Reiter

Change by Ron Reiter :


--
type:  -> security

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33213] crypt function not hashing properly on Mac (uses a specific salt)

2018-04-04 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

As far as I know macOS does not support different salt types at all. The 
manpage does mention an "extended crypt", but according to the documentation 
that just controls the number of DES rounds used.

In particular:

The salt is a 9-character array consisting of an underscore, followed by 
4 bytes of iteration count and 4 bytes of salt.  These are encoded as
printable characters, 6 bits per character, least significant character
first.  The values 0 to 63 are encoded as ``./0-9A-Za-z''.  This allows 
24 bits for both count and salt.


If anything needs to change it would have to be a macOS specific patch to the 
_crypt extension that rejects any attempt of using algorithm selection (but 
that's technically a backward incompatible change as)

--
nosy: +ronaldoussoren

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33213] crypt function not hashing properly on Mac (uses a specific salt)

2018-04-03 Thread Ned Deily

Ned Deily  added the comment:

$ ./bin/python3
Python 3.8.0a0 (heads/master:55966f3a0d, Apr  2 2018, 18:16:13)
[Clang 9.1.0 (clang-902.0.39.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import crypt
>>> crypt.methods
[]

--
nosy: +ned.deily
versions: +Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33213] crypt function not hashing properly on Mac (uses a specific salt)

2018-04-03 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

> What's the return value of crypt.crypt("test", crypt.METHOD_SHA512) 

This is from my Mac (10.13.3):

$ python3.6
Python 3.6.4 (v3.6.4:d48ecebad5, Dec 18 2017, 21:07:28)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import crypt
>>> crypt.crypt("test", crypt.METHOD_SHA512)
'$6asQOJRqB1i2'
>>> crypt.crypt("test", crypt.METHOD_SHA512)
'$6asQOJRqB1i2'
>>> crypt.crypt("test", "$5")
'$5yVOkTkyRzn.'
>>> crypt.crypt("test", "$6")
'$6asQOJRqB1i2'
>>> crypt.crypt("test", "$7")
'$7tSOkvDyiL6U'
>>> crypt.crypt("test") == crypt.crypt("test")
False
>>> crypt.crypt("test", crypt.mksalt()) == crypt.crypt("test", crypt.mksalt())
False

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33213] crypt function not hashing properly on Mac (uses a specific salt)

2018-04-03 Thread Ron Reiter

Change by Ron Reiter :


--
title: crypt function not hashing properly -> crypt function not hashing 
properly on Mac (uses a specific salt)

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com