Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Improved nonce safety#107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
psyker156 wants to merge1 commit intowoocommerce:trunk
base:trunk
Choose a base branch
Loading
frompsyker156:trunk
Open
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletionswoocommerce/oauth.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,10 +10,10 @@
__license__ = "MIT"

from time import time
fromrandom importrandint
fromos importurandom
from hmac import new as HMAC
from hashlib importsha1,sha256
from base64 import b64encode
from hashlib import sha256
from base64 import b64encode, urlsafe_b64encode
from collections import OrderedDict
from urllib.parse import urlencode, quote, unquote, parse_qsl, urlparse

Expand DownExpand Up@@ -122,10 +122,5 @@ def get_value_like_as_php(val):

@staticmethod
def generate_nonce():
""" Generate nonce number """
nonce = ''.join([str(randint(0, 9)) for i in range(8)])
return HMAC(
nonce.encode(),
"secret".encode(),
sha1
).hexdigest()
"""Generate a crypto safe random 32-byte string and encode it in Base64"""
return urlsafe_b64encode(urandom(32)).decode('utf-8').rstrip('=')

[8]ページ先頭

©2009-2025 Movatter.jp