在golang中,AES加密包cipher_amd64.go使用汇编代码(asm_amd64.s)中定义的函数。在上面提到的go文件中,只定义了函数头:
// defined in asm_amd64.s
func encryptBlockAsm(nr int, xk *uint32, dst, src *byte)
func decryptBlockAsm(nr int, xk *uint32, dst, src *byte)
func expandKeyAsm(nr int, key *byte, enc *uint32, dec *uint32)
如何在我自己的代码中使用这些功能?只是声明标题并导入上面提到的.go文件中的“加密/ aes”不起作用(undefined: expandKeyAsm
)。
非常感谢!
答案 0 :(得分:0)
package main
import "fmt"
func encryptBlockAsm(nr int, xk *uint32, dst, src *byte)
func decryptBlockAsm(nr int, xk *uint32, dst, src *byte)
func expandKeyAsm(nr int, key *byte, enc *uint32, dec *uint32)
func main() {
var nr int
var xk uint32
var dst byte
var src byte
fmt.Printf("Before:\t%v, %v, %v, %v\n", nr, xk, dst, src)
encryptBlockAsm(nr, &xk, &dst, &src)
fmt.Printf("After:\t%v, %v, %v, %v\n", nr, xk, dst, src)
}
内容复制到您的包示例(在同一个包中使用asm_amd64.s):
Before: 0, 0, 0, 0
After: 0, 0, 231, 173
收率:
protected override void OnActivityResult(int requestCode, Result resultCode, Intent intent)
{
base.OnActivityResult(requestCode, resultCode, intent);
if (requestCode == 0)
{
if (resultCode == Result.Ok)
{
string uri = data.DataString;
//intent variable has a Field named Data which is the complete URI for the file.
Android.Net.Uri uris = Android.Net.Uri.FromParts(intent.Data.Scheme, intent.Data.SchemeSpecificPart, intent.Data.Fragment);
System.IO.Stream input = ContentResolver.OpenInputStream(intent.Data);
//related tasks
}
}
}
我不知道输入应该是什么,但至少它证明了这样做:)