des

package
v1.21.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 31, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package desは米国連邦情報処理標準パブリケーション46-3で定義された、 データ暗号化標準(DES)とトリプルデータ暗号化アルゴリズム(TDEA)を実装しています。 DESは暗号学的に破れており、安全なアプリケーションには使用しないでください。

Index

Examples

Constants

View Source
const BlockSize = 8

DESのブロックサイズ(単位はバイト)。

Variables

This section is empty.

Functions

func NewCipher

func NewCipher(key []byte) (cipher.Block, error)

NewCipherは新しいcipher.Blockを作成して返します。

func NewTripleDESCipher

func NewTripleDESCipher(key []byte) (cipher.Block, error)

NewTripleDESCipher は新しい cipher.Block を作成して返します。

Example
package main

import (
	"github.com/shogo82148/std/crypto/des"
)

func main() {

	// NewTripleDESCipherは、最初の8バイトを16バイトのキーの複製として使用することで、EDE2が必要な場合にも使用することができます。
	ede2Key := []byte("example key 1234")

	var tripleDESKey []byte
	tripleDESKey = append(tripleDESKey, ede2Key[:16]...)
	tripleDESKey = append(tripleDESKey, ede2Key[:8]...)

	_, err := des.NewTripleDESCipher(tripleDESKey)
	if err != nil {
		panic(err)
	}

	// 暗号化と復号化にcipher.Blockを使用する方法は、crypto/cipherを参照してください。
}
Output:

Types

type KeySizeError

type KeySizeError int

func (KeySizeError) Error

func (k KeySizeError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL