# package crypto
`import "crypto"`
crypto包搜集了常用的密码(算法)常量。
## Index
* [type PublicKey](#PublicKey)
* [type PrivateKey](#PrivateKey)
* [type Hash](#Hash)
* [func (h Hash) Available() bool](#Hash.Available)
* [func (h Hash) Size() int](#Hash.Size)
* [func (h Hash) New() hash.Hash](#Hash.New)
* [func RegisterHash(h Hash, f func() hash.Hash)](#RegisterHash)
## type [PublicKey](https://github.com/golang/go/blob/master/src/crypto/crypto.go#L82 "View Source")
```
type PublicKey interface{}
```
代表一个使用未指定算法的公钥。
## type [PrivateKey](https://github.com/golang/go/blob/master/src/crypto/crypto.go#L85 "View Source")
```
type PrivateKey interface{}
```
代表一个使用未指定算法的私钥。
## type [Hash](https://github.com/golang/go/blob/master/src/crypto/crypto.go#L15 "View Source")
```
type Hash uint
```
Hash用来识别/标识另一个包里实现的加密函数。
```
const (
MD4 Hash = 1 + iota // 导入code.google.com/p/go.crypto/md4
MD5 // 导入crypto/md5
SHA1 // 导入crypto/sha1
SHA224 // 导入crypto/sha256
SHA256 // 导入crypto/sha256
SHA384 // 导入crypto/sha512
SHA512 // 导入crypto/sha512
MD5SHA1 // 未实现;MD5+SHA1用于TLS RSA
RIPEMD160 // 导入code.google.com/p/go.crypto/ripemd160
)
```
### func (Hash) [Available](https://github.com/golang/go/blob/master/src/crypto/crypto.go#L67 "View Source")
```
func (h Hash) Available() bool
```
报告是否有hash函数注册到该标识值。
### func (Hash) [Size](https://github.com/golang/go/blob/master/src/crypto/crypto.go#L45 "View Source")
```
func (h Hash) Size() int
```
返回给定hash函数返回值的字节长度。
### func (Hash) [New](https://github.com/golang/go/blob/master/src/crypto/crypto.go#L56 "View Source")
```
func (h Hash) New() hash.Hash
```
创建一个使用给定hash函数的hash.Hash接口,如果该标识值未注册hash函数,将会panic。
## func [RegisterHash](https://github.com/golang/go/blob/master/src/crypto/crypto.go#L74 "View Source")
```
func RegisterHash(h Hash, f func() hash.Hash)
```
注册一个返回给定hash接口实例的函数,并指定其标识值,该函数应在实现hash接口的包的init函数中调用。
- 库
- package achive
- package tar
- package zip
- package bufio
- package builtin
- package bytes
- package compress
- package bzip2
- package flate
- package gzip
- package lzw
- package zlib
- package container
- package heap
- package list
- package ring
- package crypto
- package aes
- package cipher
- package des
- package dsa
- package ecdsa
- package elliptic
- package hmac
- package md5
- package rand
- package rc4
- package rsa
- package sha1
- package sha256
- package sha512
- package subtle
- package tls
- package x509
- package pkix
- package database
- package sql
- package driver
- package encoding
- package ascii85
- package asn1
- package base32
- package base64
- package binary
- package csv
- package gob
- package hex
- package json
- package pem
- package xml
- package errors
- package expvar
- package flag
- package fmt
- package go
- package doc
- package format
- package parser
- package printer
- package hash
- package adler32
- package crc32
- package crc64
- package fnv
- package html
- package template
- package image
- package color
- package palette
- package draw
- package gif
- package jpeg
- package png
- package index
- package suffixarray
- package io
- package ioutil
- package log
- package syslog
- package math
- package big
- package cmplx
- package rand
- package mime
- package multipart
- package net
- package http
- package cgi
- package cookiejar
- package fcgi
- package httptest
- package httputil
- package pprof
- package mail
- package rpc
- package jsonrpc
- package smtp
- package textproto
- package url
- package os
- package exec
- package signal
- package user
- package path
- package filepath
- package reflect
- package regexp
- package runtime
- package cgo
- package debug
- package pprof
- package race
- package sort
- package strconv
- package strings
- package sync
- package atomic
- package text
- package scanner
- package tabwriter
- package template
- package time
- package unicode
- package utf16
- package utf8
- package unsafe