PBKDF2 Excel UDF 以及如何连接 INT(i)

2023-12-12

最近,我一直在深入研究密码学,并在 Excel 中使用哈希和加密函数,我可能会在我正在从事的项目中使用这些函数。

我使用简单的哈希函数,例如:

Function Hash(ByVal plainText As String)

    Dim utf8Encoding As Object
    Dim hashManager As Object
    Dim hashBytes() As Byte

    Set utf8Encoding = CreateObject("System.Text.UTF8Encoding")
    Set hashManager = CreateObject("System.Security.Cryptography.SHA512Managed")
    hashBytes = utf8Encoding.GetBytes_4(plainText)
    hashBytes = hashManager.ComputeHash_2(hashBytes)

    Hash = Encode(hashBytes, edHex)

    Set utf8Encoding = Nothing
    Set hashManager = Nothing

End Function

为了对结果进行编码,我创建了一个函数:

Function Encode(ByRef arrData() As Byte, ByVal dataType As endecodeDataType) As String

    Dim domDoc As Object
    Set domDoc = CreateObject("MSXML2.DOMDocument")
  
    With domDoc
        .LoadXML "<root />"
        Select Case dataType
            Case edBase64
                .DocumentElement.dataType = "bin.base64"
            Case edHex
                .DocumentElement.dataType = "bin.hex"
        End Select   
        .DocumentElement.nodeTypedValue = arrData
    End With

    Encode = domDoc.DocumentElement.Text

    Set domDoc = Nothing

End Function

这些结合起来给了我完全可验证的结果。 经过更多研究,我现在正在研究 PBKDF2 函数:

  • Specs: https://www.rfc-editor.org/rfc/rfc2898
  • 测试向量:https://www.rfc-editor.org/rfc/rfc6070

我的第一次尝试是按如下方式查看“Rfc2898DeriveBytes”:

Dim hashManager As Object
Set hashManager = CreateObject("System.Security.Cryptography.Rfc2898DeriveBytes")

但是,这会出现错误,指出无法创建 ActiveX 组件。

除了错误之外,为了尝试了解 PBKDF2 的基础知识并学习使用位/字节,我创建了以下函数:

Edit:现在我只关注 dkLen

Function PBKDF2(ByVal password As String, _
                ByVal hashIterations As Long, _
                ByVal salt As String, _
       Optional ByVal encodeHash As hashEncoding = heBase64) As Variant

    Dim utf8Encoding As Object
    Dim hashManager As Object

    Dim hmacKeyBytes() As Byte
    Dim saltBytes() As Byte

    Dim hmacBytes() As Byte
    Dim tempBytes() As Byte

    Dim i As Long

    'Create encoding and crypto objects
    Set utf8Encoding = CreateObject("System.Text.UTF8Encoding")
    Set hashManager = CreateObject("System.Security.Cryptography.HMACSHA1")
   
    'Encode the key and salt to bytes
    hmacKeyBytes = utf8Encoding.GetBytes_4(password)
    saltBytes = utf8Encoding.GetBytes_4(salt)

    'Concatenate salt and INT(i) - INT (i) is a four-octet encoding of the integer i, most significant octet first.

    'Set the key in the crypto class
    hashManager.key = hmacKeyBytes

    'Compute HMAC from salt
    hmacBytes = hashManager.ComputeHash_2(saltBytes)
    tempBytes = hmacBytes

    'HMAC iterations
    For i = 1 To hashIterations
        tempBytes = hashManager.ComputeHash_2(tempBytes)
        hmacBytes = XorBytes(tempBytes, hmacBytes)
    Next i

    'ToDo: extract the first dkLen octets to produce a derived key DK
  
    'Base64, Hex, or Byte() output
    If encodeHash = heBase64 Then
        PBKDF2 = Encode(hmacBytes, edBase64)
    ElseIf encodeHash = heHex Then
        PBKDF2 = Encode(hmacBytes, edHex)
    End If

    Set hashManager = Nothing
    Set utf8Encoding = Nothing
  
End Function

我将 XorBytes 定义为:

Function XorBytes(ByRef byte1() As Byte, ByRef byte2() As Byte) As Byte()

    Dim tempBytes() As Byte
    Dim len1 As Long
    Dim i As Long

    len1 = UBound(byte1)
    ReDim tempBytes(len1)

    For i = 0 To len1
        tempBytes(i) = byte1(i) Xor byte2(i)
    Next i

    XorBytes = tempBytes

End Function

我相信我的基础知识是正确的。我不知道如何解决的一件事是如何将 INT(i) 连接到盐。规格说明:

U_1=PRF(P,S||INT(i))

这里,INT (i) 是整数 i 的四个八位字节编码,首先是最高有效八位字节。

如何在我的 VBA 代码中实现这一点?我希望这能让我更接近这个测试向量:

  • Input
  • P =“密码”(8 个八位字节)
  • S =“盐”(4 个八位字节)
  • c = 1
  • dkLen = 20
  • Output
  • DK = 0c 60 c8 0f 96 1f 0e 71 f3 a9 b5 24 af 60 12 06 2f e0 37 a6(20 个八位字节)

经过一番摆弄后,下面的函数返回我可以验证的输出:

https://www.rfc-editor.org/rfc/rfc6070

Enums

Enum hmacAlgorithm
    HMAC_MD5
    HMAC_SHA1
    HMAC_SHA256
    HMAC_SHA384
    HMAC_SHA512
End Enum

Enum hashEncoding
    heBase64
    heHex
    heNone_Bytes
End Enum

PBKDF2 功能

Function PBKDF2(ByVal password As String, _
    ByVal salt As String, _
    ByVal hashIterations As Long, _
    ByVal algoritm As hmacAlgorithm, _
    Optional ByVal dkLen As Long, _
    Optional ByVal encodeHash As hashEncoding = heBase64) As Variant

'https://www.rfc-editor.org/rfc/rfc2898 - PKCS #5: Password-Based Cryptography Specification Version 2.0
'https://www.rfc-editor.org/rfc/rfc6070 - PKCS #5: Password-Based Key Derivation Function 2 (PBKDF2) Test Vectors
'https://en.wikipedia.org/wiki/PBKDF2

'DK = T1 || T2 || ... || Tdklen/hlen
'Ti = F(password, salt, c, i)
'
'F(Password, Salt, c, i) = U1 ^ U2 ^ ... ^ Uc
'
'U_1 = PRF (P, S || INT (i)) (INT (i) is a four-octet encoding of the integer i, most significant octet first.)
'U_2 = PRF (P, U_1)
'...
'U_c = PRF (P, U_{c-1})

Dim utf8Encoding As Object
Dim hashManager As Object

Dim hLen As Long
Dim noBlocks As Long
Dim noBlock As Long

Dim hmacKeyBytes() As Byte
Dim saltBytes() As Byte
Dim uboundSaltBytes As Long

Dim hmacBytes() As Byte
Dim tempBytes() As Byte
Dim outputBytes() As Byte

Dim i As Long
Dim j As Long

'Create utf8-encoding object
Set utf8Encoding = CreateObject("System.Text.UTF8Encoding")

'Create hmac object
Select Case algoritm
    Case HMAC_MD5
        Set hashManager = CreateObject("System.Security.Cryptography.HMACMD5")
    Case HMAC_SHA1
        Set hashManager = CreateObject("System.Security.Cryptography.HMACSHA1")
    Case HMAC_SHA256
        Set hashManager = CreateObject("System.Security.Cryptography.HMACSHA256")
    Case HMAC_SHA384
        Set hashManager = CreateObject("System.Security.Cryptography.HMACSHA384")
    Case HMAC_SHA512
        Set hashManager = CreateObject("System.Security.Cryptography.HMACSHA512")
End Select

'Check the length of the blocks to be generated
hLen = hashManager.HashSize / 8

'Calculate amount of blocks 'T'
If dkLen = 0 Then dkLen = hLen
noBlocks = Application.WorksheetFunction.Ceiling(dkLen / hLen, 1)
   
'Encode the key and salt to bytes
hmacKeyBytes = utf8Encoding.GetBytes_4(password)
saltBytes = utf8Encoding.GetBytes_4(salt)

'Set the key in the crypto class
hashManager.key = hmacKeyBytes

'Get the length of the salt, add 4 to concatenate INT(I)
uboundSaltBytes = UBound(saltBytes) + 4

'Loop T1 || T2 || ... || Tdklen/hlen
For i = 1 To noBlocks

    'Salt || INT(i)
    'INT (i) is a four-octet encoding of the integer i, most significant octet first.
    tempBytes = saltBytes
    ReDim Preserve tempBytes(uboundSaltBytes)
    noBlock = i

    'Calculate INT(i) of Salt || INT(i)
    For j = 3 To 0 Step -1
        tempBytes(uboundSaltBytes - j) = Int(noBlock / (255 ^ j))
        noBlock = noBlock - Int(noBlock / (255 ^ j)) * 255 ^ j
    Next j
     
    'Hash U1: Salt || INT(i)
    hmacBytes = hashManager.ComputeHash_2(tempBytes)
    tempBytes = hmacBytes
     
    'Hash, Xor: U1 ^ U2 ^ ... ^ Uc
    For j = 1 To hashIterations - 1
        hmacBytes = hashManager.ComputeHash_2(hmacBytes)
        tempBytes = XorBytes(tempBytes, hmacBytes)
    Next j
  
    'For the first block outputBytes() is empty
    If i = 1 Then
        outputBytes = tempBytes
    Else
        ConcatenateArrayInPlace outputBytes, tempBytes
    End If

Next i

'Extract the first dkLen octets to produce a derived key DK:
ReDim Preserve outputBytes(dkLen - 1)
  
'Base64, Hex, or Byte() output
If encodeHash = heBase64 Then
    PBKDF2 = Encode(outputBytes, edBase64)
ElseIf encodeHash = heHex Then
    PBKDF2 = Encode(outputBytes, edHex)
Else
    PBKDF2 = outputBytes
End If

Set hashManager = Nothing
Set utf8Encoding = Nothing
  
End Function

HMAC功能

Function HMAC(ByVal plainText As String, _
    ByVal algoritm As hmacAlgorithm, _
    Optional ByVal key As String, _
    Optional ByVal decodeKey As keyDecoding = kdNone_String, _
    Optional ByVal encodeHash As hashEncoding = heBase64) As Variant

Dim hashManager As Object

Dim hashBytes() As Byte
Dim hmacKeyBytes() As Byte

'Create the specific hash manager based on the hash algoritm
Select Case algoritm
    Case HMAC_MD5
        Set hashManager = CreateObject("System.Security.Cryptography.HMACMD5") 'Returns 128 bits, 16 bytes
    Case HMAC_SHA1
        Set hashManager = CreateObject("System.Security.Cryptography.HMACSHA1") 'Returns 160 bits, 20 bytes
    Case HMAC_SHA256
        Set hashManager = CreateObject("System.Security.Cryptography.HMACSHA256") 'Returns 256 bits, 32 bytes
    Case HMAC_SHA384
        Set hashManager = CreateObject("System.Security.Cryptography.HMACSHA384") 'Returns 384 bits, 48 bytes
    Case HMAC_SHA512
        Set hashManager = CreateObject("System.Security.Cryptography.HMACSHA512") 'Returns 512 bits, 64 bytes
End Select

'Encode the plaintText to bytes
hashBytes = UTF8_GetBytes(plainText)

If key = vbNullString Then
  
    'Get the key generated by the hashManager
    hmacKeyBytes = hashManager.key

    'Calculate the hash
    hashBytes = hashManager.ComputeHash_2(hashBytes)

    'Return encoded result
    If encodeHash = heBase64 Then
        HMAC = "<Key>" & Encode(hmacKeyBytes, edBase64) & "<Key>" & vbCrLf & Encode(hashBytes, edBase64)
    ElseIf encodeHash = heHex Then
        HMAC = "<Key>" & Encode(hmacKeyBytes, edHex) & "<Key>" & vbCrLf & Encode(hashBytes, edHex)
    End If

Else

    'Decode and set the key
    Select Case decodeKey
    Case kdBase64
        hashManager.key = Decode(key, edBase64)
    Case kdHex
        hashManager.key = Decode(key, edHex)
    Case Else
        hashManager.key = UTF8_GetBytes(key)
    End Select

    'Calculate the hash
    hashBytes = hashManager.ComputeHash_2(hashBytes)

    'Return encoded result
    If encodeHash = heBase64 Then
        HMAC = Encode(hashBytes, edBase64)
    ElseIf encodeHash = heHex Then
        HMAC = Encode(hashBytes, edHex)
    End If

End If

Set hashManager = Nothing

End Function

测试子程序:

Sub PBKDF2_Test()

Dim testvector As String
Dim pbkdf2_result As String

pbkdf2_result = PBKDF2("password", "salt", 1, HMAC_SHA1, 20, heHex)
testvector = "0c60c80f961f0e71f3a9b524af6012062fe037a6"
If pbkdf2_result = testvector Then Debug.Print "TV1: OK" Else Debug.Print "TV1: FAULT"

pbkdf2_result = PBKDF2("password", "salt", 2, HMAC_SHA1, 20, heHex)
testvector = "ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957"
If pbkdf2_result = testvector Then Debug.Print "TV2: OK" Else Debug.Print "TV2: FAULT"

pbkdf2_result = PBKDF2("password", "salt", 4096, HMAC_SHA1, 20, heHex)
testvector = "4b007901b765489abead49d926f721d065a429c1"
If pbkdf2_result = testvector Then Debug.Print "TV3: OK" Else Debug.Print "TV3: FAULT"

pbkdf2_result = PBKDF2("passwordPASSWORDpassword", "saltSALTsaltSALTsaltSALTsaltSALTsalt", 4096, HMAC_SHA1, 25, heHex)
testvector = "3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038"
If pbkdf2_result = testvector Then Debug.Print "TV4: OK" Else Debug.Print "TV4: FAULT"

End Sub

我想这不是最漂亮的代码,但它是向前迈出的一步。请随意改进!

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

PBKDF2 Excel UDF 以及如何连接 INT(i) 的相关文章

  • Excel的INDEX函数可以返回数组吗?

    如果数据在范围内A1 A4如下 Apple Banana Orange Strawberry Then INDEX可用于单独返回该列表中的任何值 例如 INDEX A1 A4 3 会回来Orange 是否有类似的 Excel 函数或函数组合
  • VBA cDate 无法在 Mac excel 2011(14.7.1) 上运行

    我正在尝试使用 VBA 脚本将日期转换为长日期 下面是代码片段 Sub test Dim str as string Dim d as variant str 1 1 2016 d cdate str end sub 上面的代码片段在 Wi
  • 将 Excel 模板 (xltx) 作为 Excel 模板而不是工作簿打开

    我正在尝试编写一行代码来打开 Excel 模板 xltx 文件作为 Excel 模板文件而不是新工作簿 我只是想让用户查看和编辑他们在我们网络上的库文件夹中的模板 然而 我尝试过的所有操作都会打开一个新的工作簿而不是模板 我尝试过互操作 W
  • 如何同时在多个 Wksheet 中搜索某个字符串?

    我有大约 30 张工作表 我希望这些代码同时运行 我想找到 ABC 并删除所有工作表中它旁边的单元格的值 我的错误来自 Set rSearch range A1 range A rows count end x1up 当我在 With 语句
  • 如何连接两个字典来创建一个新字典? [复制]

    这个问题在这里已经有答案了 假设我有三个字典 d1 1 2 3 4 d2 5 6 7 9 d3 10 8 13 22 我如何创建一个新的d4结合了这三个字典 IE d4 1 2 3 4 5 6 7 9 10 8 13 22 最慢并且在 Py
  • VBA 中的 Excel 下拉列表:“无法获取工作表类的 DropDowns 属性”

    我有这个代码 Sub addDropdown Name ActiveSheet DropDowns Add 74 25 60 188 25 87 75 Select Set n ActiveSheet DropDowns Name If N
  • 如何在 Excel VBA 中仅迭代自动筛选工作表中的行?

    需要仅迭代自动筛选范围中的行 目的是获取行索引 我尝试过这个块 For Each ele In rng RowInd ele Rows Address RowNum Split RowInd 2 Next ele 这会在 rng 中的所有
  • Excel 中数字的条件格式(自定义格式)具有多个条件

    我想根据单元格中的值动态地将数字格式化为 M 百万 B 十亿 或 K 千 我尝试过 但这不起作用 gt 1000000000 0 B gt 1000000 0 M gt 1000 0 K 0 如果我给出任意两个条件 它就会起作用 例如 gt
  • VB.NET 中的 Excel 自动调整列

    我这里有我的 VB6 代码并且运行良好 For CLms 1 To 10 ws Columns CLms AutoFit lt Autofilt data on XL sheet Next CLms 我已经搜索了如何在 VB NET 中使
  • 基于两列值的VLOOKUP

    我有一个表 其中一列包含用户 ID 这些被多次输入以显示特定主题的结果 ID Topic Pass Fail 71086686 Science P 71086686 Maths P 71086686 Tech P 71086686 ICT
  • 如何使用 VBA 在 Excel 中搜索单词然后删除整行? [复制]

    这个问题在这里已经有答案了 请有人帮忙 我正在尝试编写一个 VBA 代码 在 Excel 工作表 D 列中搜索特定单词 DR 然后删除整行 工作表中特定单词多次出现 我想做的就是搜索这些出现的情况 然后删除包含这些单词的整行 我的问题是我不
  • 点击后如何等待页面加载

    下面是简单的 IE 自动化代码 只需输入订单号 例如1413105088和邮政编码始终是78759并单击 提交 按钮 然后从结果页面中获取跟踪号码 例如017136295201034并将它们放入 C 列 它按预期工作 但由于 IE 不太可靠
  • 从 Rest API 响应内容处置输出中下载 javascript 中的 excel 文件 [对象,对象]

    我想从我的 angularJs 代码下载一个 excel 文件 我向 Java Rest API 发出 http post 请求并返回带有标头的文件 Content Disposition 附件 文件名 new excel file xls
  • 是否可以编写自定义 Power Query 连接器?

    在 来自其他来源 下的 Power Query 中 我们看到许多专业提供商 Facebook SAP SalesForce 等 我有兴趣编写一个自定义提供程序来访问无法通过任何内置连接器使用的本地专有数据存储 我知道 访问没有支持连接器的数
  • 如何检查单元格是否包含通配符星号 (*) 字符

    考虑以下两个公式 IF SEARCH A1 true false IF SEARCH CHAR 42 A1 true false 我正在用它来尝试检测单元格是否包含 字符 但这对所有单元格返回 true 我只能假设 Excel 看到 也许作
  • 条件格式化VBA多个条件

    我对 VBA 世界非常陌生 需要一些关于条件格式的 VBA 方面的帮助 1 我需要将条件格式应用于列 M 7岁以下绿色 黄色从7 20 红色大于20 最重要的条件是 如果列 N 声明 NOPO 则我不希望应用条件格式 我已经制定了一个公式来
  • 如何使用 xlrd 将新列和行添加到 .xls 文件

    如何向 xlrd 中的工作表添加新列和 或行 我有一个使用 open workbook 读取的 xls 文件 我需要在第一张表中添加一个新列 bouncebacks 然后在该表中添加新行 但我在 xlrd 文档中找不到任何显示如何添加新行和
  • 修剪工作簿中的所有单元格(VBA)

    我尝试向一直在开发的 Excel 加载项添加功能 该功能会修剪已用单元格末尾的前导空格 甚至可能解析文本 我需要这样做的原因只是为了将其变成超链接我已经在工作了 但是那部分很好 这是我到目前为止所尝试的 我已经修剪了active works
  • 父子进程隔离和子进程列表

    请阅读以下模板 PID Status LPID 10 Closed 25 11 Open 25 31 Open 31 25 Closed 25 54 Open 31 17 Open 17 20 Closed 31 88 closed 77
  • 有没有办法破解 Excel VBA 项目的密码?

    我被要求更新一些 Excel 2003 宏 但 VBA 项目受密码保护 而且似乎缺少文档 没有人知道密码 有没有办法删除或破解 VBA 项目上的密码 你可以直接尝试这个VBA不需要十六进制编辑的方法 它适用于任何文件 xls xlsm xl

随机推荐

  • Hibernate Search:为自定义 FieldBridge 配置 Facet

    在这个例子中DateSplitBridge java动态字段被添加到索引文档中 public class DateSplitBridge implements FieldBridge public void set String name
  • 检查哪个摄像头是前置摄像头还是后置摄像头 Android

    我知道我可以设置一个boolean flag while opening front Camera 如果 flag 为 true 则表示前置摄像头已打开 但是有没有办法使用 Android API 知道哪个相机现在处于打开状态 正面或背面
  • SQLAlchemy 循环一对一关系

    我正在尝试与 SQLAlchemy 建立循环的一对一关系 不确定正确的术语是什么 如下所示 class Parent Base tablename parents id db Column Integer primary key True
  • 当绑定发生在另一个函数中时,Sqlite _only_ 找不到行

    所以我自己写了一个小包装函数来为我准备一个声明 sqlite3 stmt Gladiateur run query unfinalized string query vector
  • WPF,使用 XAML 中的 XPath 和 XmlDataProvider 根据 ComboBox 中选定的值选择节点

    这个问题与我的上一个问题但更具体 假设我有两个组合框 一个填充了产品名称 另一个为空 选择产品后 我希望第二个组合框填充与该产品相关的数据 我有如下 XML
  • Microsoft Office OneNote C++ API?

    我正在考虑通过 C 编程修改 Microsoft Office OneNote 内容 具体在使用快速归档对话框界面 但是那里提供的所有示例都是针对C 的 我想知道C 的API是否可用 如果有的话我可以从哪里开始学习它们 我只是想使用该对话框
  • Angular 5测试组件静态方法

    我正在测试的 Component 类上有一个静态方法 我的问题是如何在我的规范测试文件中访问该方法 到目前为止 我可以通过以下方式访问组件实例 let fixture TestBed createComponent MyComponent
  • 如何执行递归搜索?

    我有一个任务类 它可以有相同类型的子任务 public class Task public DateTime Start get set public DateTime Finish get set public List
  • 我对套接字的 fwrite 不会刷新,直到套接字关闭。如何改变?

    我对套接字的 fwrite 不会刷新 直到套接字关闭 如何改变 我希望它在每次写入后刷新 我试过了 1 冲洗 2 刷新 3 ob implicit flush 真 这些都不起作用 我仍然必须退出 php 让我的套接字接收数据 包括一些示例代
  • Rails:如何使用范围在数组数组中查找元素

    我有一个数组数组 例如 2 3 3 1 6 1 每个子数组的第一个元素是用户 ID 第二个元素是用户为活动预订的座位数 我想让每个用户通过在数组中查找他的 ID 来查看他的预订 假设我有两个模型 用户和事件 在用户控制器中 我想使用类似的范
  • 唯一标识调试器中的引用类型

    我有 C 背景 如果这是非 C 的思维方式 我很抱歉 但我只需要知道 在 C 中 如果我有两个指针 并且我想知道它们是否指向同一对象 我可以查看内存 监视窗口并查看它们的值 看看它们是否指向相同的内存空间 在 C 中 我还没有找到类似的东西
  • Silverlight 中的对象深复制

    我试图创建对象的副本银光5其中 IFormatters 和 IcCloanble 等接口不支持 我的对象是这样的 注意这些对象是在反序列化xml时获得的 我尝试像这样复制 XmlRoot ElementName component publ
  • 如何更改每个选项卡的颜色?

    我有一个表单 上面有四个选项卡 我希望每个选项卡具有不同的颜色 我在互联网上找到的唯一内容是如何更改所选选项卡的颜色 而其余选项卡保持原始颜色 我还没有找到任何东西可以为每个选项卡赋予自己的颜色 我目前拥有的代码是 Private Sub
  • 通过谷歌脚本更改表单调色板

    我需要帮助 我正在使用 Google 应用程序脚本来创建 Google 表单 如何更改表单的颜色 调色板 我试图在这里找到https developers google com apps script reference forms 但什么
  • 如何使用 Xamarin Forms 创建具有垂直粘性标题和水平粘性第一列的表格?

    在显示表格数据时 我认为在某些情况下 具有始终可见的标题行和始终可见的第一列确实可以提高表格的可读性和整体可用性 特别是当表格中有大量数据时 当表格必须支持水平和垂直滚动时 就会出现问题 在查看过去比赛的得分时 可以从 NBA 应用程序中找
  • 整数线性编程 Java:有多种开源和商业工具可用。使用哪一个?

    我需要为我的应用程序使用整数线性编程 API 工具 虽然我的应用程序是用 Java 编写的 但我不介意从 Java 调用 EXE 工具 使用文件 MPS 等 提供输入 我的搜索分析如下 有多种开源和商业工具可用于解决 ILP 以下问题 我发
  • 如何在Python中获取函数的实际参数名称?

    例如 def func a how to get the name x x 1 func x 如果我使用inspect模块我可以获得堆栈帧对象 import inspect def func a print inspect stack ou
  • WPF - 如何以编程方式备份​​/恢复 LocalDB - ClickOnce

    我有一个使用 EF 和 LocalDB 作为数据库的应用程序 由 ClickOnce 发布 这是我第一次使用 LocalDB 我不知道如何向我的应用程序添加一个功能来以编程方式备份 恢复数据库 我的 ClickOnce 安装的应用程序路径
  • 使用 UITextPosition,从 textInRange 获取前一个字符

    我一直在寻找 但不知道如何做到这一点 假设我有一个这样的字符串 NSString string foo foo 我想做的是区分文本视图中的两个 foo 听起来很有趣哈哈 当我单击一个时 我想知道它前面是哪个 或 我是这样理解这个词的 UIT
  • PBKDF2 Excel UDF 以及如何连接 INT(i)

    最近 我一直在深入研究密码学 并在 Excel 中使用哈希和加密函数 我可能会在我正在从事的项目中使用这些函数 我使用简单的哈希函数 例如 Function Hash ByVal plainText As String Dim utf8En