小编Min*_*Con的帖子

将system.windows.media.brush转换为Hex颜色代码

在我的Windows phone7应用程序中,我放置了一个画布,并将其背景颜色设置为一些十六进制颜色代码.现在我无法通过c#代码获取十六进制颜色代码值.我使用下面的代码,但它给出了系统中的颜色值. windows.media.brush.Plz帮我解答?

clr = Convert.ToString(clr1.Background);
Run Code Online (Sandbox Code Playgroud)

.net c# colors windows-phone-7 windows-phone-7.1

5
推荐指数
1
解决办法
1万
查看次数

AES 256 Nodejs 加密和在 C#.Net 中解密

我尝试在 C# 中解密的数据在 Nodejs 中使用 AES-256 算法进行加密,代码如下。

const crypto = require('crypto');
const validator = require('validator');
const algorithm = 'aes256';
const inputEncoding = 'utf8';
const outputEncoding = 'hex';
const iv = crypto.randomBytes(16)

function encrypt(key,text) {
key = processKey(key);
let cipher = crypto.createCipheriv(algorithm, key, iv);
let ciphered = cipher.update(text, inputEncoding, outputEncoding);
ciphered += cipher.final(outputEncoding);
return ciphered;
}
Run Code Online (Sandbox Code Playgroud)

现在,我获得了长度为 32 的加密数据(如“1234567304e07a5d2e93fbeefd0e417e”)和长度为 32 的密​​钥(如“123456673959499f9d37623168b2c977”)。

我尝试使用下面的 C# 代码解密相同的内容,但收到错误“要解密的数据长度无效”。请提供建议。

public static string Decrypt(string combinedString, string keyString)
{
    string plainText;
    byte[] combinedData = StringToByteArray(combinedString);
    Aes aes = …
Run Code Online (Sandbox Code Playgroud)

.net c# encryption cryptography node.js

2
推荐指数
1
解决办法
2639
查看次数