mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 12:33:03 +00:00
fix merge conflict
This commit is contained in:
@@ -32,5 +32,11 @@ def create_hash(*args: str, decode=False, limit=10) -> str:
|
||||
str_ = unidecode(str_)
|
||||
|
||||
str_ = str_.encode("utf-8")
|
||||
str_ = hashlib.sha256(str_).hexdigest()
|
||||
return str_[-limit:]
|
||||
str_ = hashlib.sha1(str_).hexdigest()
|
||||
# REVIEW Switched to sha1 hashlib.sha256(str_).hexdigest()
|
||||
|
||||
# REVIEW Take the first limit/2 and last limit/2 characters
|
||||
# This is to avoid collisions
|
||||
return str_[:limit // 2] + str_[-limit // 2:] if limit % 2 == 0 else str_[:limit // 2] + str_[-limit // 2 - 1:]
|
||||
|
||||
# return str_[-limit:]
|
||||
|
||||
@@ -3,10 +3,12 @@ import socket as Socket
|
||||
|
||||
def has_connection(host="google.it", port=80, timeout=3):
|
||||
"""
|
||||
# REVIEW Was:
|
||||
Host: 8.8.8.8 (google-public-dns-a.google.com)
|
||||
OpenPort: 53/tcp
|
||||
Service: domain (DNS/TCP)
|
||||
"""
|
||||
|
||||
try:
|
||||
Socket.setdefaulttimeout(timeout)
|
||||
Socket.socket(Socket.AF_INET, Socket.SOCK_STREAM).connect((host, port))
|
||||
|
||||
Reference in New Issue
Block a user