python passlib 加密与 c# 不同

问题描述

有一段用python写的旧代码

它使用 import requests from bs4 import BeautifulSoup url = 'https://stackoverflow.com/questions?tab=newest&page=' r = requests.post(url) soup = BeautifulSoup(r.text,'lxml').find('div',id='questions').find_all('div') for summary in soup: # FIXME: Prints each question twice try: print(f'Question: {summary.h3.text}') print(f'Tags: {",".join(summary.find("div",class_="tags").text[1:].split(" "))}') except Exception as e: print(e) # Prints "'nonetype' has no attribute 'text'" which shouldn't be in the soup

使用它生成 sha256

我们正在改用 C# 并计划使用 passlib=1.7.2

问题是输出不同。

蟒蛇:

passlib.net

C#:

# input: test
sha256_crypt.encrypt("test")
# output: $5$rounds=535000$20RZoqz9LUemohVj$JaTvUcf6ZAg8j03P1k0vpmx0hhG5Pmq9i45HfeCmYk5

我知道 C# 输出的第二部分是 // input: test new PasslibNet.Algorithms.Sha256(salt: "20RZoqz9LUemohVj",rounds: 535000).Encrypt("test"); // output: $5$rounds=535000$OABwAEoAVAA0ADIAbwBwAC4AYgBpAEgAaABMAEIANAA=$ZNFKcDpvVsWD3N0p/nKHJM8MtSCVb1/goGoDwAAYxVM= 编码的。但是最后一部分和python代码不一样。

有谁知道我如何在 C# 中实现 python 的输出

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)