登录 立即注册

找到11523个回复

罐子 4楼回复 罐子组装台式电脑预算7500以内 (2023-02-17//)

C:\Users\Admin\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
一加8Pro

艾木友尔尔巴 10楼回复 艾木友尔尔巴win10 有没有高效快速搜索电脑文本内容的方法 (2023-02-15//)

@卷心菜,应该是1,我每次进去就输入wsl。

小米8(白)

老虎会游泳 3楼回复 胡椒舰长【楼主删除了该帖】 (2023-02-15//)

计算机体系结构并没有原生的引用功能,只有原生的指针功能。所以在编译后的二进制程序里,所有引用操作都会被翻译为指针操作。

老虎会游泳 2楼回复 胡椒舰长【楼主删除了该帖】 (2023-02-15//)

@胡椒舰长,map变量的值是指向存储map数据结构的内存地址。在C中,我们通常把这样的变量叫做指针变量。传递引用就是传递指针变量的值,也就是传递内存地址,也就是传递一个整数。

胡椒舰长 1楼回复 胡椒舰长【楼主删除了该帖】 (2023-02-15//)

@老虎会游泳,为什么他第一句说

在赋值时,会复制一份指向底层数据结构的引用。如果你在一个函数中修改了 map,那么调用该函数的地方也会看到这个修改。

那这个引用类型和变量有啥区别,变量不也是在当前函数中可以看到改变

蛋黄派 15楼回复 胡图图J1900很耗电吗? (2023-02-15//)
@000,老板只打包,不单出了……
罐子 4楼回复 HongKongDollPHP怎么使用 SHA256withRSA进行加密 (2023-02-15//)

使用go进行RSA256加密

使用Go进行RSA256加密,需要进行以下步骤:

生成密钥对
首先,你需要生成一个RSA密钥对,包括一个私钥和一个公钥。你可以使用Go内置的crypto/rand和crypto/rsa包来生成密钥对。

以下是一个生成2048位RSA密钥对的示例代码:

go
Copy code
package main

import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"os"
)

func main() {
bitSize := 2048

privateKey, err := rsa.GenerateKey(rand.Reader, bitSize)
if err != nil {
    panic(err)
}

privateKeyBytes := x509.MarshalPKCS1PrivateKey(privateKey)
privateKeyPem := pem.EncodeToMemory(&pem.Block{
    Type:  "RSA PRIVATE KEY",
    Bytes: privateKeyBytes,
})
err = os.WriteFile("private_key.pem", privateKeyPem, 0644)
if err != nil {
    panic(err)
}

publicKeyBytes, err := x509.MarshalPKIXPublicKey(&privateKey.PublicKey)
if err != nil {
    panic(err)
}
publicKeyPem := pem.EncodeToMemory(&pem.Block{
    Type:  "RSA PUBLIC KEY",
    Bytes: publicKeyBytes,
})
err = os.WriteFile("public_key.pem", publicKeyPem, 0644)
if err != nil {
    panic(err)
}

}
这将生成一个名为private_key.pem的私钥文件和一个名为public_key.pem的公钥文件。

使用私钥进行加密
接下来,你需要使用私钥对要加密的数据进行签名。

以下是一个使用Go内置的crypto/rsa包进行加密的示例:

go
Copy code
package main

import (
"crypto/rand"
"crypto/rsa"
"crypto/sha256"
"encoding/base64"
"io/ioutil"
)

func main() {
data := []byte("要加密的数据")

privateKeyBytes, err := ioutil.ReadFile("private_key.pem")
if err != nil {
    panic(err)
}
privateKey, err := x509.ParsePKCS1PrivateKey(privateKeyBytes)
if err != nil {
    panic(err)
}

hashed := sha256.Sum256(data)
signature, err := rsa.SignPKCS1v15(rand.Reader, privateKey, crypto.SHA256, hashed[:])
if err != nil {
    panic(err)
}

fmt.Println(base64.StdEncoding.EncodeToString(signature))

}
在这个示例中,data是要加密的数据,privateKeyBytes是从私钥文件中读取的私钥。

使用sha256.Sum256函数对原始数据进行哈希,使用rsa.SignPKCS1v15函数对哈希结果进行签名,其中第三个参数crypto.SHA256指定了使用SHA256哈希算法进行签名。

最后,使用base64.StdEncoding.EncodeToString函数将签名结果转换为字符串并输出。

使用公钥进行验证
在接收方收到数据后,可以使用公钥来验证签名的有效性。

以下是一个使用Go内置的crypto/rsa包进行验证的示例:

java
Copy code
package main

import (
"crypto/rsa"
"crypto/sha256"
"encoding/base64"
"io/ioutil"
)





继续

继续上面的示例代码:

go
Copy code
func main() {
data := []byte("要加密的数据")

publicKeyBytes, err := ioutil.ReadFile("public_key.pem")
if err != nil {
    panic(err)
}
publicKey, err := x509.ParsePKIXPublicKey(publicKeyBytes)
if err != nil {
    panic(err)
}
rsaPublicKey := publicKey.(*rsa.PublicKey)

signatureBase64 := "签名的字符串"
signature, err := base64.StdEncoding.DecodeString(signatureBase64)
if err != nil {
    panic(err)
}

hashed := sha256.Sum256(data)
err = rsa.VerifyPKCS1v15(rsaPublicKey, crypto.SHA256, hashed[:], signature)
if err != nil {
    panic(err)
}

fmt.Println("签名验证成功")

}
在这个示例中,publicKeyBytes是从公钥文件中读取的公钥,使用x509.ParsePKIXPublicKey函数将公钥解析为*rsa.PublicKey类型的对象。

signatureBase64是前面加密步骤中生成的签名字符串,使用base64.StdEncoding.DecodeString函数将其转换为字节数组。

使用sha256.Sum256函数对原始数据进行哈希,使用rsa.VerifyPKCS1v15函数对哈希结果和签名进行验证,其中第二个参数crypto.SHA256指定了使用SHA256哈希算法进行验证。

如果验证通过,则输出"签名验证成功",否则会抛出错误。






ChatGPT Feb 13 Version. Free Research Preview. Our goal is to make AI systems more natural and safe to interact with. Your feedback will help us improve.
一加8Pro

残缘 22楼回复 残缘20元的个人服务器(随身wifi.附刷机资料链接) (2023-02-15//)
@没落的情绪,我后来买了个还没拆封,晚上回去拆开看看
罐子 3楼回复 HongKongDollPHP怎么使用 SHA256withRSA进行加密 (2023-02-15//)

PHP怎么使用 SHA256withRSA进行加密

使用SHA256withRSA进行加密,需要进行以下步骤:

准备密钥对
首先,你需要生成一个RSA密钥对,包括一个私钥和一个公钥。你可以使用openssl库来生成密钥对。

以下是一个生成2048位RSA密钥对的示例命令:

csharp
Copy code
openssl genrsa -out private_key.pem 2048
openssl rsa -in private_key.pem -outform PEM -pubout -out public_key.pem
这将生成一个名为private_key.pem的私钥文件和一个名为public_key.pem的公钥文件。

使用私钥进行加密
接下来,你需要使用私钥对要加密的数据进行签名。

以下是一个使用PHP内置的OpenSSL函数进行加密的示例:

bash
Copy code
$data = '要加密的数据';
$private_key = openssl_get_privatekey(file_get_contents('private_key.pem'));

openssl_sign($data, $signature, $private_key, OPENSSL_ALGO_SHA256);

echo base64_encode($signature);
在这个示例中,$data是要加密的数据,$private_key是从私钥文件中加载的私钥。

openssl_sign函数接受要签名的数据、一个签名结果的变量和一个私钥。OPENSSL_ALGO_SHA256指定了使用SHA256哈希算法进行签名。

最后,我们使用base64_encode函数将签名结果转换为字符串并输出。

使用公钥进行验证
在接收方收到数据后,可以使用公钥来验证签名的有效性。

以下是一个使用PHP内置的OpenSSL函数进行验证的示例:

php
Copy code
$data = '要加密的数据';
$signature = base64_decode('签名结果字符串');
$public_key = openssl_get_publickey(file_get_contents('public_key.pem'));

$valid = openssl_verify($data, $signature, $public_key, OPENSSL_ALGO_SHA256);

if ($valid == 1) {
echo '签名验证通过';
} elseif ($valid == 0) {
echo '签名验证失败';
} else {
echo '签名验证出错';
}
在这个示例中,$data是原始数据,$signature是从发送方收到的签名结果,$public_key是从公钥文件中加载的公钥。

openssl_verify函数接受原始数据、签名结果、公钥和哈希算法。如果签名验证通过,它将返回1,如果签名验证失败,它将返回0,如果出现错误,它将返回-1。

以上就是使用PHP进行SHA256withRSA加密和验证的基本步骤。
一加8Pro

2楼回复 HongKongDollPHP怎么使用 SHA256withRSA进行加密 (2023-02-15//)
百度第一条就能看到
https://blog.csdn.net/xinqingch/article/details/123113705
罐子 1楼回复 HongKongDollPHP怎么使用 SHA256withRSA进行加密 (2023-02-15//)

@HongKongDoll,你可以问问chatgpt
一加8Pro

没落的情绪 21楼回复 残缘20元的个人服务器(随身wifi.附刷机资料链接) (2023-02-14//)

@残缘,没螺丝刀拆开

sylar 16楼回复 老虎会游泳【Wine游戏助手】WeGame兼容游戏列表(已兼容国服LOL,但可能会被封号) (2023-02-14//)
emm楼主,wegame能进去,但是游戏无法进去。操作系统是Ubuntu 22.04.1 LTS。
下面是游戏日志,尝试过从windows拷贝对应的dll进去,但是进wegame就报错,它认为是系统升级了补丁,需要重启
Start monitoring process.
esync: up and running.
Initial process has exited (return code: 0)
wine: Call from 0000000170031FB8 to unimplemented function ntoskrnl.exe.KeInitializeGuardedMutex, aborting
wine: Unimplemented function ntoskrnl.exe.KeInitializeGuardedMutex called at address 0000000170031FB8 (thread 0e3c), starting debugger...
wine: Call from 000000007B0123AE to unimplemented function ntoskrnl.exe.MmGetPhysicalMemoryRanges, aborting
wine: Unimplemented function ntoskrnl.exe.MmGetPhysicalMemoryRanges called at address 000000007B0123AE (thread 0ec4), starting debugger...
wine: Call from 000000007B0123AE to unimplemented function ncrypt.dll.NCryptEnumStorageProviders, aborting
wine: Call from 000000007B0123AE to unimplemented function ntoskrnl.exe.MmGetPhysicalMemoryRanges, aborting
wine: Unimplemented function ntoskrnl.exe.MmGetPhysicalMemoryRanges called at address 000000007B0123AE (thread 0f28), starting debugger...
wine: Call from 0000000170025280 to unimplemented function ntdll.dll.RtlWalkFrameChain, aborting
wine: Call from 0000000170025280 to unimplemented function ntdll.dll.RtlWalkFrameChain, aborting
wine: Call from 0000000170025280 to unimplemented function ntdll.dll.RtlWalkFrameChain, aborting
wine: Call from 0000000170025280 to unimplemented function ntdll.dll.RtlWalkFrameChain, aborting
wine: Call from 0000000170025280 to unimplemented function ntdll.dll.RtlWalkFrameChain, aborting
wine: Call from 0000000170025280 to unimplemented function ntdll.dll.RtlWalkFrameChain, aborting
wine: Call from 0000000170025280 to unimplemented function ntdll.dll.RtlWalkFrameChain, aborting
wine: Call from 0000000170025280 to unimplemented function ntdll.dll.RtlWalkFrameChain, aborting
wine: Call from 0000000170025280 to unimplemented function ntdll.dll.RtlWalkFrameChain, aborting
wine: Call from 0000000170025280 to unimplemented function ntdll.dll.RtlWalkFrameChain, aborting
wine: Call from 0000000170025280 to unimplemented function ntdll.dll.RtlWalkFrameChain, aborting
艾木友尔尔巴 8楼回复 艾木友尔尔巴win10 有没有高效快速搜索电脑文本内容的方法 (2023-02-14//)

@卷心菜,试过,太慢。文件太多。用时太久,我用anytxt索引都建立完了,文件都搜索到了,wsl还在搜索
小米8(白)

艾木友尔尔巴 6楼回复 艾木友尔尔巴win10 有没有高效快速搜索电脑文本内容的方法 (2023-02-14//)

@hik,空了试试,谢谢你
小米8(白)

艾木友尔尔巴 5楼回复 艾木友尔尔巴win10 有没有高效快速搜索电脑文本内容的方法 (2023-02-14//)

@罐子,你说的快速搜索吧,类似everything,我也在用,他不能搜索文本内容。只能搜索文件名
小米8(白)

罐子 4楼回复 艾木友尔尔巴win10 有没有高效快速搜索电脑文本内容的方法 (2023-02-14//)

@艾木友尔尔巴,我360桌面助手
一加8Pro

hik 3楼回复 艾木友尔尔巴win10 有没有高效快速搜索电脑文本内容的方法 (2023-02-14//)
这款是不用建索引的,直接搜虽然效率慢但准确点
https://hik.lanzoue.com/ipTCo0fgu5uh
艾木友尔尔巴 2楼回复 艾木友尔尔巴win10 有没有高效快速搜索电脑文本内容的方法 (2023-02-14//)

@Curtion,真神器呀。感谢。一下就找到了。就是建立索引用的时间久点。但是比系统自带搜索快万倍
小米8(白)

hik 16楼回复 hikChatGPT免代理体验AI聊天插件 (2023-02-14//)
@TabKey9,模型不一样吧,他们自用的网页端模型可能比较新,提供给别人的API就没chatgpt自己网页端好,@游魂,把DALL·E文生图都集成了,不错很棒
下一页 上一页 (267 / 577页)

11月12日 04:21 星期三

本站由hu60wap6驱动

备案号: 京ICP备18041936号-1