Microsoft ドキュメント HashedData Object (Windows) 関連する記事 VBScript : ネイティブ Base64 エンコード
Set CAPIUtil = CreateObject( "CAPICOM.Utilities" ) Set HashedData = CreateObject( "CAPICOM.HashedData" ) Set Stream = Wscript.CreateObject("ADODB.Stream") Set StreamBin = Wscript.CreateObject("ADODB.Stream") '*********************************************************** ' データ準備4 '*********************************************************** Stream.Open Stream.Charset = "shift_jis" ' shift_jis で入力文字を書き込む Stream.WriteText "日本語表示OK" Stream.Position = 0 ' バイナリで開く StreamBin.Open StreamBin.Type = 1 ' テキストをバイナリに変換 Stream.CopyTo StreamBin Stream.Close ' 読み込みの為にデータポインタを先頭にセット StreamBin.Position = 0 strBinaryString = CAPIUtil.ByteArrayToBinaryString( StreamBin.Read ) '*********************************************************** ' SHA1 と MD5 と SHA256 '*********************************************************** ' SHA1 HashedData.Algorithm = 0 HashedData.Hash(strBinaryString) MsgBox(LCase(HashedData.Value)) ' MD5 HashedData.Algorithm = 3 HashedData.Hash(strBinaryString) MsgBox(LCase(HashedData.Value)) ' SHA256 HashedData.Algorithm = 4 HashedData.Hash(strBinaryString) MsgBox(LCase(HashedData.Value))
Set CAPIUtil = CreateObject( "CAPICOM.Utilities" ) Set HashedData = CreateObject( "CAPICOM.HashedData" ) Set Stream = Wscript.CreateObject("ADODB.Stream") Set StreamBin = Wscript.CreateObject("ADODB.Stream") '*********************************************************** ' データ準備4 '*********************************************************** Stream.Open Stream.Charset = "shift_jis" ' shift_jis で入力文字を書き込む Stream.WriteText "日本語表示OK" Stream.Position = 0 ' バイナリで開く StreamBin.Open StreamBin.Type = 1 ' テキストをバイナリに変換 Stream.CopyTo StreamBin Stream.Close ' 読み込みの為にデータポインタを先頭にセット StreamBin.Position = 0 strBinaryString = CAPIUtil.ByteArrayToBinaryString( StreamBin.Read ) Dim strTarget '*********************************************************** ' SHA512 ' https://www.microsoft.com/ja-jp/download/details.aspx?id=3207 ' https://docs.microsoft.com/ja-jp/windows/desktop/seccrypto/capicom-hash-algorithm ' C:\Windows\Syswow64\cscript.exe で実行 '*********************************************************** ' SHA512 strTarget = strBinaryString HashedData.Algorithm = 6 HashedData.Hash(strTarget) MsgBox(LCase(HashedData.Value))
VBScriptドキュメント
|
【VBS + オブジェクトの最新記事】
- 簡易詳細設計書(A4)作成 : VBScript + Excel.Application
- VBScript : 複数テキストファイルの charset(キャラクタセット) 一括変換 / ADODB.Stream
- VBScript : 既存の Excel を PDF に変換する ( ExportAsFixedFormat )
- テーブル設計書作成 : VBScript + Excel.Application + SQLServer
- VBScript : Excel.Application でファイルを複数選択する
- ブラウザ上にあるデータを PHP で受け取って、VBScript のコードを作成して事前に作成済のテンプレート Excel にデータをロードして印刷で使用する
- VBScript : Access のテーブルを TransferText メソッドを使用して UTF-8 で CSV または HTML にして出力する
- VBScript : ネイティブ(CAPICOM.Utilities) Base64 エンコード
- VBScript で、スクリプト(Windows Script Component)をオブジェクトとして直接使う方法
- VBScript : バイナリファイルの更新( 1バイトの ByteArray なら、ADO.Stream で作成できます )
- VBScript : ini ファイルの値を取得する
- VBS : My Documents フォルダのような、特殊フォルダのサイズを取得する
【VBScript関連のカテゴリ】