id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
149,900 | Azure/azure-docker-extension | pkg/vmextension/status/status.go | Save | func (r StatusReport) Save(statusFolder string, seqNum int) error {
fn := fmt.Sprintf("%d.status", seqNum)
path := filepath.Join(statusFolder, fn)
tmpFile, err := ioutil.TempFile(statusFolder, fn)
if err != nil {
return fmt.Errorf("status: failed to create temporary file: %v", err)
}
tmpFile.Close()
b, err :=... | go | func (r StatusReport) Save(statusFolder string, seqNum int) error {
fn := fmt.Sprintf("%d.status", seqNum)
path := filepath.Join(statusFolder, fn)
tmpFile, err := ioutil.TempFile(statusFolder, fn)
if err != nil {
return fmt.Errorf("status: failed to create temporary file: %v", err)
}
tmpFile.Close()
b, err :=... | [
"func",
"(",
"r",
"StatusReport",
")",
"Save",
"(",
"statusFolder",
"string",
",",
"seqNum",
"int",
")",
"error",
"{",
"fn",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"seqNum",
")",
"\n",
"path",
":=",
"filepath",
".",
"Join",
"(",
"statusFo... | // Save persists the status message to the specified status folder using the
// sequence number. The operation consists of writing to a temporary file in the
// same folder and moving it to the final destination for atomicity. | [
"Save",
"persists",
"the",
"status",
"message",
"to",
"the",
"specified",
"status",
"folder",
"using",
"the",
"sequence",
"number",
".",
"The",
"operation",
"consists",
"of",
"writing",
"to",
"a",
"temporary",
"file",
"in",
"the",
"same",
"folder",
"and",
"m... | d1d2547150489b2495a8d09a642e7f515bbf484f | https://github.com/Azure/azure-docker-extension/blob/d1d2547150489b2495a8d09a642e7f515bbf484f/pkg/vmextension/status/status.go#L61-L82 |
149,901 | Azure/azure-docker-extension | op-enable.go | installCompose | func installCompose(path string, url string) error {
// Check if already installed at path.
if ok, err := util.PathExists(path); err != nil {
return err
} else if ok {
log.Printf("docker-compose is already installed at %s", path)
return nil
}
// Create dir if not exists
dir := filepath.Dir(path)
ok, err :... | go | func installCompose(path string, url string) error {
// Check if already installed at path.
if ok, err := util.PathExists(path); err != nil {
return err
} else if ok {
log.Printf("docker-compose is already installed at %s", path)
return nil
}
// Create dir if not exists
dir := filepath.Dir(path)
ok, err :... | [
"func",
"installCompose",
"(",
"path",
"string",
",",
"url",
"string",
")",
"error",
"{",
"// Check if already installed at path.",
"if",
"ok",
",",
"err",
":=",
"util",
".",
"PathExists",
"(",
"path",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\... | // installCompose download docker-compose from given url and saves to the specified path if it
// is not already installed. | [
"installCompose",
"download",
"docker",
"-",
"compose",
"from",
"given",
"url",
"and",
"saves",
"to",
"the",
"specified",
"path",
"if",
"it",
"is",
"not",
"already",
"installed",
"."
] | d1d2547150489b2495a8d09a642e7f515bbf484f | https://github.com/Azure/azure-docker-extension/blob/d1d2547150489b2495a8d09a642e7f515bbf484f/op-enable.go#L165-L205 |
149,902 | Azure/azure-docker-extension | op-enable.go | loginRegistry | func loginRegistry(s dockerLoginSettings) error {
if !s.HasLoginInfo() {
log.Println("registry login not specificied")
return nil
}
opts := []string{
"login",
"--email=" + s.Email,
"--username=" + s.Username,
"--password=" + s.Password,
}
if s.Server != "" {
opts = append(opts, s.Server)
}
_, err :... | go | func loginRegistry(s dockerLoginSettings) error {
if !s.HasLoginInfo() {
log.Println("registry login not specificied")
return nil
}
opts := []string{
"login",
"--email=" + s.Email,
"--username=" + s.Username,
"--password=" + s.Password,
}
if s.Server != "" {
opts = append(opts, s.Server)
}
_, err :... | [
"func",
"loginRegistry",
"(",
"s",
"dockerLoginSettings",
")",
"error",
"{",
"if",
"!",
"s",
".",
"HasLoginInfo",
"(",
")",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"opts",
":=",
"[",
"]",
"string",
... | // loginRegistry calls the `docker login` command to authenticate the engine to the
// specified registry with given credentials. | [
"loginRegistry",
"calls",
"the",
"docker",
"login",
"command",
"to",
"authenticate",
"the",
"engine",
"to",
"the",
"specified",
"registry",
"with",
"given",
"credentials",
"."
] | d1d2547150489b2495a8d09a642e7f515bbf484f | https://github.com/Azure/azure-docker-extension/blob/d1d2547150489b2495a8d09a642e7f515bbf484f/op-enable.go#L209-L228 |
149,903 | Azure/azure-docker-extension | op-enable.go | composeBinPath | func composeBinPath(d driver.DistroDriver) string {
return filepath.Join(d.DockerComposeDir(), composeBin)
} | go | func composeBinPath(d driver.DistroDriver) string {
return filepath.Join(d.DockerComposeDir(), composeBin)
} | [
"func",
"composeBinPath",
"(",
"d",
"driver",
".",
"DistroDriver",
")",
"string",
"{",
"return",
"filepath",
".",
"Join",
"(",
"d",
".",
"DockerComposeDir",
"(",
")",
",",
"composeBin",
")",
"\n",
"}"
] | // composeBinPath returns the path docker-compose binary should be installed at
// on the host operating system. | [
"composeBinPath",
"returns",
"the",
"path",
"docker",
"-",
"compose",
"binary",
"should",
"be",
"installed",
"at",
"on",
"the",
"host",
"operating",
"system",
"."
] | d1d2547150489b2495a8d09a642e7f515bbf484f | https://github.com/Azure/azure-docker-extension/blob/d1d2547150489b2495a8d09a642e7f515bbf484f/op-enable.go#L232-L234 |
149,904 | Azure/azure-docker-extension | op-enable.go | composeUp | func composeUp(d driver.DistroDriver, json map[string]interface{}, publicEnv, protectedEnv map[string]string) error {
if len(json) == 0 {
log.Println("docker-compose config not specified, noop")
return nil
}
// Convert json to yaml
yaml, err := yaml.Marshal(json)
if err != nil {
return fmt.Errorf("error con... | go | func composeUp(d driver.DistroDriver, json map[string]interface{}, publicEnv, protectedEnv map[string]string) error {
if len(json) == 0 {
log.Println("docker-compose config not specified, noop")
return nil
}
// Convert json to yaml
yaml, err := yaml.Marshal(json)
if err != nil {
return fmt.Errorf("error con... | [
"func",
"composeUp",
"(",
"d",
"driver",
".",
"DistroDriver",
",",
"json",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"publicEnv",
",",
"protectedEnv",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"if",
"len",
"(",
"json",
")",
... | // composeUp converts given json to yaml, saves to a file on the host and
// uses `docker-compose up -d` to create the containers. | [
"composeUp",
"converts",
"given",
"json",
"to",
"yaml",
"saves",
"to",
"a",
"file",
"on",
"the",
"host",
"and",
"uses",
"docker",
"-",
"compose",
"up",
"-",
"d",
"to",
"create",
"the",
"containers",
"."
] | d1d2547150489b2495a8d09a642e7f515bbf484f | https://github.com/Azure/azure-docker-extension/blob/d1d2547150489b2495a8d09a642e7f515bbf484f/op-enable.go#L238-L291 |
149,905 | Azure/azure-docker-extension | op-enable.go | installDockerCerts | func installDockerCerts(s DockerHandlerSettings, dstDir string) error {
m := []struct {
src string
dst string
}{
{s.Certs.CABase64, filepath.Join(dstDir, dockerCaCert)},
{s.Certs.ServerCertBase64, filepath.Join(dstDir, dockerSrvCert)},
{s.Certs.ServerKeyBase64, filepath.Join(dstDir, dockerSrvKey)},
}
// ... | go | func installDockerCerts(s DockerHandlerSettings, dstDir string) error {
m := []struct {
src string
dst string
}{
{s.Certs.CABase64, filepath.Join(dstDir, dockerCaCert)},
{s.Certs.ServerCertBase64, filepath.Join(dstDir, dockerSrvCert)},
{s.Certs.ServerKeyBase64, filepath.Join(dstDir, dockerSrvKey)},
}
// ... | [
"func",
"installDockerCerts",
"(",
"s",
"DockerHandlerSettings",
",",
"dstDir",
"string",
")",
"error",
"{",
"m",
":=",
"[",
"]",
"struct",
"{",
"src",
"string",
"\n",
"dst",
"string",
"\n",
"}",
"{",
"{",
"s",
".",
"Certs",
".",
"CABase64",
",",
"file... | // installDockerCerts saves the configured certs to the specified dir
// if and only if the certs are not already placed there. If no certs
// are provided or some certs already exist, nothing is written. | [
"installDockerCerts",
"saves",
"the",
"configured",
"certs",
"to",
"the",
"specified",
"dir",
"if",
"and",
"only",
"if",
"the",
"certs",
"are",
"not",
"already",
"placed",
"there",
".",
"If",
"no",
"certs",
"are",
"provided",
"or",
"some",
"certs",
"already"... | d1d2547150489b2495a8d09a642e7f515bbf484f | https://github.com/Azure/azure-docker-extension/blob/d1d2547150489b2495a8d09a642e7f515bbf484f/op-enable.go#L296-L338 |
149,906 | Azure/azure-docker-extension | op-enable.go | getArgs | func getArgs(s DockerHandlerSettings, dd driver.DistroDriver) string {
args := dd.BaseOpts()
if s.Certs.HasDockerCerts() {
tls := []string{"--tlsverify",
fmt.Sprintf("--tlscacert=%s", filepath.Join(dockerCfgDir, dockerCaCert)),
fmt.Sprintf("--tlscert=%s", filepath.Join(dockerCfgDir, dockerSrvCert)),
fmt.S... | go | func getArgs(s DockerHandlerSettings, dd driver.DistroDriver) string {
args := dd.BaseOpts()
if s.Certs.HasDockerCerts() {
tls := []string{"--tlsverify",
fmt.Sprintf("--tlscacert=%s", filepath.Join(dockerCfgDir, dockerCaCert)),
fmt.Sprintf("--tlscert=%s", filepath.Join(dockerCfgDir, dockerSrvCert)),
fmt.S... | [
"func",
"getArgs",
"(",
"s",
"DockerHandlerSettings",
",",
"dd",
"driver",
".",
"DistroDriver",
")",
"string",
"{",
"args",
":=",
"dd",
".",
"BaseOpts",
"(",
")",
"\n\n",
"if",
"s",
".",
"Certs",
".",
"HasDockerCerts",
"(",
")",
"{",
"tls",
":=",
"[",
... | // getArgs provides set of arguments that should be used in updating Docker
// daemon options based on the distro. | [
"getArgs",
"provides",
"set",
"of",
"arguments",
"that",
"should",
"be",
"used",
"in",
"updating",
"Docker",
"daemon",
"options",
"based",
"on",
"the",
"distro",
"."
] | d1d2547150489b2495a8d09a642e7f515bbf484f | https://github.com/Azure/azure-docker-extension/blob/d1d2547150489b2495a8d09a642e7f515bbf484f/op-enable.go#L351-L372 |
149,907 | Azure/azure-docker-extension | pkg/executil/exec.go | ExecWithStdin | func ExecWithStdin(in io.ReadCloser, program string, args ...string) ([]byte, error) {
var b bytes.Buffer
cmd := osexec.Command(program, args...)
cmd.Stdin = in
cmd.Stdout = &b
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
err = fmt.Errorf("executing %s failed: %v", program, err)
}
return b.Bytes()... | go | func ExecWithStdin(in io.ReadCloser, program string, args ...string) ([]byte, error) {
var b bytes.Buffer
cmd := osexec.Command(program, args...)
cmd.Stdin = in
cmd.Stdout = &b
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
err = fmt.Errorf("executing %s failed: %v", program, err)
}
return b.Bytes()... | [
"func",
"ExecWithStdin",
"(",
"in",
"io",
".",
"ReadCloser",
",",
"program",
"string",
",",
"args",
"...",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"var",
"b",
"bytes",
".",
"Buffer",
"\n",
"cmd",
":=",
"osexec",
".",
"Command",
... | // ExecWithStdin pipes given ReadCloser's contents to the stdin of executed
// command and returns stdout as bytes and redirects stderr of executed command
// stderr of executing process. | [
"ExecWithStdin",
"pipes",
"given",
"ReadCloser",
"s",
"contents",
"to",
"the",
"stdin",
"of",
"executed",
"command",
"and",
"returns",
"stdout",
"as",
"bytes",
"and",
"redirects",
"stderr",
"of",
"executed",
"command",
"stderr",
"of",
"executing",
"process",
"."... | d1d2547150489b2495a8d09a642e7f515bbf484f | https://github.com/Azure/azure-docker-extension/blob/d1d2547150489b2495a8d09a642e7f515bbf484f/pkg/executil/exec.go#L78-L89 |
149,908 | bernerdschaefer/eventsource | encoder.go | Flush | func (e *Encoder) Flush() error {
_, err := e.w.Write([]byte{'\n'})
e.w.Flush()
return err
} | go | func (e *Encoder) Flush() error {
_, err := e.w.Write([]byte{'\n'})
e.w.Flush()
return err
} | [
"func",
"(",
"e",
"*",
"Encoder",
")",
"Flush",
"(",
")",
"error",
"{",
"_",
",",
"err",
":=",
"e",
".",
"w",
".",
"Write",
"(",
"[",
"]",
"byte",
"{",
"'\\n'",
"}",
")",
"\n",
"e",
".",
"w",
".",
"Flush",
"(",
")",
"\n",
"return",
"err",
... | // Flush sends an empty line to signal event is complete, and flushes the
// writer. | [
"Flush",
"sends",
"an",
"empty",
"line",
"to",
"signal",
"event",
"is",
"complete",
"and",
"flushes",
"the",
"writer",
"."
] | 220e99a797633289b5472f80c2cd79a74d80a954 | https://github.com/bernerdschaefer/eventsource/blob/220e99a797633289b5472f80c2cd79a74d80a954/encoder.go#L39-L43 |
149,909 | bernerdschaefer/eventsource | encoder.go | WriteField | func (e *Encoder) WriteField(field string, value []byte) error {
if !utf8.ValidString(field) || !utf8.Valid(value) {
return ErrInvalidEncoding
}
for _, line := range bytes.Split(value, []byte{'\n'}) {
if len(line) > 0 && line[len(line)-1] == '\r' {
line = line[:len(line)-1]
}
if err := e.writeField(fiel... | go | func (e *Encoder) WriteField(field string, value []byte) error {
if !utf8.ValidString(field) || !utf8.Valid(value) {
return ErrInvalidEncoding
}
for _, line := range bytes.Split(value, []byte{'\n'}) {
if len(line) > 0 && line[len(line)-1] == '\r' {
line = line[:len(line)-1]
}
if err := e.writeField(fiel... | [
"func",
"(",
"e",
"*",
"Encoder",
")",
"WriteField",
"(",
"field",
"string",
",",
"value",
"[",
"]",
"byte",
")",
"error",
"{",
"if",
"!",
"utf8",
".",
"ValidString",
"(",
"field",
")",
"||",
"!",
"utf8",
".",
"Valid",
"(",
"value",
")",
"{",
"re... | // WriteField writes an event field to the connection. If the provided value
// contains newlines, multiple fields will be emitted. If the returned error is
// not nil, it will be either ErrInvalidEncoding or an error from the
// connection. | [
"WriteField",
"writes",
"an",
"event",
"field",
"to",
"the",
"connection",
".",
"If",
"the",
"provided",
"value",
"contains",
"newlines",
"multiple",
"fields",
"will",
"be",
"emitted",
".",
"If",
"the",
"returned",
"error",
"is",
"not",
"nil",
"it",
"will",
... | 220e99a797633289b5472f80c2cd79a74d80a954 | https://github.com/bernerdschaefer/eventsource/blob/220e99a797633289b5472f80c2cd79a74d80a954/encoder.go#L49-L65 |
149,910 | bernerdschaefer/eventsource | encoder.go | Encode | func (e *Encoder) Encode(event Event) error {
if event.ResetID || len(event.ID) > 0 {
if err := e.WriteField("id", []byte(event.ID)); err != nil {
return err
}
}
if len(event.Retry) > 0 {
if err := e.WriteField("retry", []byte(event.Retry)); err != nil {
return err
}
}
if len(event.Type) > 0 {
if... | go | func (e *Encoder) Encode(event Event) error {
if event.ResetID || len(event.ID) > 0 {
if err := e.WriteField("id", []byte(event.ID)); err != nil {
return err
}
}
if len(event.Retry) > 0 {
if err := e.WriteField("retry", []byte(event.Retry)); err != nil {
return err
}
}
if len(event.Type) > 0 {
if... | [
"func",
"(",
"e",
"*",
"Encoder",
")",
"Encode",
"(",
"event",
"Event",
")",
"error",
"{",
"if",
"event",
".",
"ResetID",
"||",
"len",
"(",
"event",
".",
"ID",
")",
">",
"0",
"{",
"if",
"err",
":=",
"e",
".",
"WriteField",
"(",
"\"",
"\"",
",",... | // Encode writes an event to the connection. | [
"Encode",
"writes",
"an",
"event",
"to",
"the",
"connection",
"."
] | 220e99a797633289b5472f80c2cd79a74d80a954 | https://github.com/bernerdschaefer/eventsource/blob/220e99a797633289b5472f80c2cd79a74d80a954/encoder.go#L78-L102 |
149,911 | bernerdschaefer/eventsource | handler.go | ServeHTTP | func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "no-cache")
w.Header().Set("Vary", "Accept")
if !h.acceptable(r.Header.Get("Accept")) {
w.WriteHeader(http.StatusNotAcceptable)
return
}
w.Header().Set("Content-Type", "text/event-stream")
w.WriteHeader(http... | go | func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "no-cache")
w.Header().Set("Vary", "Accept")
if !h.acceptable(r.Header.Get("Accept")) {
w.WriteHeader(http.StatusNotAcceptable)
return
}
w.Header().Set("Content-Type", "text/event-stream")
w.WriteHeader(http... | [
"func",
"(",
"h",
"Handler",
")",
"ServeHTTP",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"w",
".",
"Header",
... | // ServeHTTP calls h with an Encoder and a close notification channel. It
// performs Content-Type negotiation. | [
"ServeHTTP",
"calls",
"h",
"with",
"an",
"Encoder",
"and",
"a",
"close",
"notification",
"channel",
".",
"It",
"performs",
"Content",
"-",
"Type",
"negotiation",
"."
] | 220e99a797633289b5472f80c2cd79a74d80a954 | https://github.com/bernerdschaefer/eventsource/blob/220e99a797633289b5472f80c2cd79a74d80a954/handler.go#L38-L57 |
149,912 | bernerdschaefer/eventsource | eventsource.go | New | func New(req *http.Request, retry time.Duration) *EventSource {
req.Header.Set("Accept", "text/event-stream")
req.Header.Set("Cache-Control", "no-cache")
return &EventSource{
retry: retry,
request: req,
}
} | go | func New(req *http.Request, retry time.Duration) *EventSource {
req.Header.Set("Accept", "text/event-stream")
req.Header.Set("Cache-Control", "no-cache")
return &EventSource{
retry: retry,
request: req,
}
} | [
"func",
"New",
"(",
"req",
"*",
"http",
".",
"Request",
",",
"retry",
"time",
".",
"Duration",
")",
"*",
"EventSource",
"{",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"req",
".",
"Header",
".",
"Set",
"(",
"... | // New prepares an EventSource. The connection is automatically managed, using
// req to connect, and retrying from recoverable errors after waiting the
// provided retry duration. | [
"New",
"prepares",
"an",
"EventSource",
".",
"The",
"connection",
"is",
"automatically",
"managed",
"using",
"req",
"to",
"connect",
"and",
"retrying",
"from",
"recoverable",
"errors",
"after",
"waiting",
"the",
"provided",
"retry",
"duration",
"."
] | 220e99a797633289b5472f80c2cd79a74d80a954 | https://github.com/bernerdschaefer/eventsource/blob/220e99a797633289b5472f80c2cd79a74d80a954/eventsource.go#L49-L57 |
149,913 | bernerdschaefer/eventsource | eventsource.go | connect | func (es *EventSource) connect() {
for es.err == nil {
if es.r != nil {
es.r.Close()
<-time.After(es.retry)
}
es.request.Header.Set("Last-Event-Id", es.lastEventID)
resp, err := http.DefaultClient.Do(es.request)
if err != nil {
continue // reconnect
}
if resp.StatusCode >= 500 {
// assume... | go | func (es *EventSource) connect() {
for es.err == nil {
if es.r != nil {
es.r.Close()
<-time.After(es.retry)
}
es.request.Header.Set("Last-Event-Id", es.lastEventID)
resp, err := http.DefaultClient.Do(es.request)
if err != nil {
continue // reconnect
}
if resp.StatusCode >= 500 {
// assume... | [
"func",
"(",
"es",
"*",
"EventSource",
")",
"connect",
"(",
")",
"{",
"for",
"es",
".",
"err",
"==",
"nil",
"{",
"if",
"es",
".",
"r",
"!=",
"nil",
"{",
"es",
".",
"r",
".",
"Close",
"(",
")",
"\n",
"<-",
"time",
".",
"After",
"(",
"es",
".... | // Connect to an event source, validate the response, and gracefully handle
// reconnects. | [
"Connect",
"to",
"an",
"event",
"source",
"validate",
"the",
"response",
"and",
"gracefully",
"handle",
"reconnects",
"."
] | 220e99a797633289b5472f80c2cd79a74d80a954 | https://github.com/bernerdschaefer/eventsource/blob/220e99a797633289b5472f80c2cd79a74d80a954/eventsource.go#L69-L106 |
149,914 | bernerdschaefer/eventsource | decoder.go | ReadField | func (d *Decoder) ReadField() (field string, value []byte, err error) {
if !d.checkedBOM {
d.checkBOM()
}
var buf []byte
for {
line, isPrefix, err := d.r.ReadLine()
if err != nil {
return "", nil, err
}
buf = append(buf, line...)
if !isPrefix {
break
}
}
if len(buf) == 0 {
return "", n... | go | func (d *Decoder) ReadField() (field string, value []byte, err error) {
if !d.checkedBOM {
d.checkBOM()
}
var buf []byte
for {
line, isPrefix, err := d.r.ReadLine()
if err != nil {
return "", nil, err
}
buf = append(buf, line...)
if !isPrefix {
break
}
}
if len(buf) == 0 {
return "", n... | [
"func",
"(",
"d",
"*",
"Decoder",
")",
"ReadField",
"(",
")",
"(",
"field",
"string",
",",
"value",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"if",
"!",
"d",
".",
"checkedBOM",
"{",
"d",
".",
"checkBOM",
"(",
")",
"\n",
"}",
"\n\n",
"var... | // ReadField reads a single line from the stream and parses it as a field. A
// complete event is signalled by an empty key and value. The returned error
// may either be an error from the stream, or an ErrInvalidEncoding if the
// value is not valid UTF-8. | [
"ReadField",
"reads",
"a",
"single",
"line",
"from",
"the",
"stream",
"and",
"parses",
"it",
"as",
"a",
"field",
".",
"A",
"complete",
"event",
"is",
"signalled",
"by",
"an",
"empty",
"key",
"and",
"value",
".",
"The",
"returned",
"error",
"may",
"either... | 220e99a797633289b5472f80c2cd79a74d80a954 | https://github.com/bernerdschaefer/eventsource/blob/220e99a797633289b5472f80c2cd79a74d80a954/decoder.go#L41-L83 |
149,915 | bernerdschaefer/eventsource | decoder.go | Decode | func (d *Decoder) Decode(e *Event) error {
var wroteData bool
// set default event type
e.Type = "message"
for {
field, value, err := d.ReadField()
if err != nil {
return err
}
if len(field) == 0 && len(value) == 0 {
break
}
switch field {
case "id":
e.ID = string(value)
if len(e.ID) ... | go | func (d *Decoder) Decode(e *Event) error {
var wroteData bool
// set default event type
e.Type = "message"
for {
field, value, err := d.ReadField()
if err != nil {
return err
}
if len(field) == 0 && len(value) == 0 {
break
}
switch field {
case "id":
e.ID = string(value)
if len(e.ID) ... | [
"func",
"(",
"d",
"*",
"Decoder",
")",
"Decode",
"(",
"e",
"*",
"Event",
")",
"error",
"{",
"var",
"wroteData",
"bool",
"\n\n",
"// set default event type",
"e",
".",
"Type",
"=",
"\"",
"\"",
"\n\n",
"for",
"{",
"field",
",",
"value",
",",
"err",
":=... | // Decode reads the next event from its input and stores it in the provided
// Event pointer. | [
"Decode",
"reads",
"the",
"next",
"event",
"from",
"its",
"input",
"and",
"stores",
"it",
"in",
"the",
"provided",
"Event",
"pointer",
"."
] | 220e99a797633289b5472f80c2cd79a74d80a954 | https://github.com/bernerdschaefer/eventsource/blob/220e99a797633289b5472f80c2cd79a74d80a954/decoder.go#L87-L125 |
149,916 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/elgamal/elgamal.go | Encrypt | func Encrypt(random io.Reader, pub *PublicKey, msg []byte) (c1, c2 *big.Int, err error) {
pLen := (pub.P.BitLen() + 7) / 8
if len(msg) > pLen-11 {
err = errors.New("elgamal: message too long")
return
}
// EM = 0x02 || PS || 0x00 || M
em := make([]byte, pLen-1)
em[0] = 2
ps, mm := em[1:len(em)-len(msg)-1], e... | go | func Encrypt(random io.Reader, pub *PublicKey, msg []byte) (c1, c2 *big.Int, err error) {
pLen := (pub.P.BitLen() + 7) / 8
if len(msg) > pLen-11 {
err = errors.New("elgamal: message too long")
return
}
// EM = 0x02 || PS || 0x00 || M
em := make([]byte, pLen-1)
em[0] = 2
ps, mm := em[1:len(em)-len(msg)-1], e... | [
"func",
"Encrypt",
"(",
"random",
"io",
".",
"Reader",
",",
"pub",
"*",
"PublicKey",
",",
"msg",
"[",
"]",
"byte",
")",
"(",
"c1",
",",
"c2",
"*",
"big",
".",
"Int",
",",
"err",
"error",
")",
"{",
"pLen",
":=",
"(",
"pub",
".",
"P",
".",
"Bit... | // Encrypt encrypts the given message to the given public key. The result is a
// pair of integers. Errors can result from reading random, or because msg is
// too large to be encrypted to the public key. | [
"Encrypt",
"encrypts",
"the",
"given",
"message",
"to",
"the",
"given",
"public",
"key",
".",
"The",
"result",
"is",
"a",
"pair",
"of",
"integers",
".",
"Errors",
"can",
"result",
"from",
"reading",
"random",
"or",
"because",
"msg",
"is",
"too",
"large",
... | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/elgamal/elgamal.go#L37-L68 |
149,917 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/elgamal/elgamal.go | nonZeroRandomBytes | func nonZeroRandomBytes(s []byte, rand io.Reader) (err error) {
_, err = io.ReadFull(rand, s)
if err != nil {
return
}
for i := 0; i < len(s); i++ {
for s[i] == 0 {
_, err = io.ReadFull(rand, s[i:i+1])
if err != nil {
return
}
}
}
return
} | go | func nonZeroRandomBytes(s []byte, rand io.Reader) (err error) {
_, err = io.ReadFull(rand, s)
if err != nil {
return
}
for i := 0; i < len(s); i++ {
for s[i] == 0 {
_, err = io.ReadFull(rand, s[i:i+1])
if err != nil {
return
}
}
}
return
} | [
"func",
"nonZeroRandomBytes",
"(",
"s",
"[",
"]",
"byte",
",",
"rand",
"io",
".",
"Reader",
")",
"(",
"err",
"error",
")",
"{",
"_",
",",
"err",
"=",
"io",
".",
"ReadFull",
"(",
"rand",
",",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"retur... | // nonZeroRandomBytes fills the given slice with non-zero random octets. | [
"nonZeroRandomBytes",
"fills",
"the",
"given",
"slice",
"with",
"non",
"-",
"zero",
"random",
"octets",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/elgamal/elgamal.go#L106-L122 |
149,918 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/signature.go | parseSignatureSubpackets | func parseSignatureSubpackets(sig *Signature, subpackets []byte, isHashed bool) (err error) {
for len(subpackets) > 0 {
subpackets, err = parseSignatureSubpacket(sig, subpackets, isHashed)
if err != nil {
return
}
}
if sig.CreationTime.IsZero() {
err = errors.StructuralError("no creation time in signatur... | go | func parseSignatureSubpackets(sig *Signature, subpackets []byte, isHashed bool) (err error) {
for len(subpackets) > 0 {
subpackets, err = parseSignatureSubpacket(sig, subpackets, isHashed)
if err != nil {
return
}
}
if sig.CreationTime.IsZero() {
err = errors.StructuralError("no creation time in signatur... | [
"func",
"parseSignatureSubpackets",
"(",
"sig",
"*",
"Signature",
",",
"subpackets",
"[",
"]",
"byte",
",",
"isHashed",
"bool",
")",
"(",
"err",
"error",
")",
"{",
"for",
"len",
"(",
"subpackets",
")",
">",
"0",
"{",
"subpackets",
",",
"err",
"=",
"par... | // parseSignatureSubpackets parses subpackets of the main signature packet. See
// RFC 4880, section 5.2.3.1. | [
"parseSignatureSubpackets",
"parses",
"subpackets",
"of",
"the",
"main",
"signature",
"packet",
".",
"See",
"RFC",
"4880",
"section",
"5",
".",
"2",
".",
"3",
".",
"1",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/signature.go#L176-L189 |
149,919 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/signature.go | serializeSubpacketLength | func serializeSubpacketLength(to []byte, length int) int {
// RFC 4880, Section 4.2.2.
if length < 192 {
to[0] = byte(length)
return 1
}
if length < 16320 {
length -= 192
to[0] = byte((length >> 8) + 192)
to[1] = byte(length)
return 2
}
to[0] = 255
to[1] = byte(length >> 24)
to[2] = byte(length >> 1... | go | func serializeSubpacketLength(to []byte, length int) int {
// RFC 4880, Section 4.2.2.
if length < 192 {
to[0] = byte(length)
return 1
}
if length < 16320 {
length -= 192
to[0] = byte((length >> 8) + 192)
to[1] = byte(length)
return 2
}
to[0] = 255
to[1] = byte(length >> 24)
to[2] = byte(length >> 1... | [
"func",
"serializeSubpacketLength",
"(",
"to",
"[",
"]",
"byte",
",",
"length",
"int",
")",
"int",
"{",
"// RFC 4880, Section 4.2.2.",
"if",
"length",
"<",
"192",
"{",
"to",
"[",
"0",
"]",
"=",
"byte",
"(",
"length",
")",
"\n",
"return",
"1",
"\n",
"}"... | // serializeSubpacketLength marshals the given length into to. | [
"serializeSubpacketLength",
"marshals",
"the",
"given",
"length",
"into",
"to",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/signature.go#L408-L426 |
149,920 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/signature.go | subpacketsLength | func subpacketsLength(subpackets []outputSubpacket, hashed bool) (length int) {
for _, subpacket := range subpackets {
if subpacket.hashed == hashed {
length += subpacketLengthLength(len(subpacket.contents) + 1)
length += 1 // type byte
length += len(subpacket.contents)
}
}
return
} | go | func subpacketsLength(subpackets []outputSubpacket, hashed bool) (length int) {
for _, subpacket := range subpackets {
if subpacket.hashed == hashed {
length += subpacketLengthLength(len(subpacket.contents) + 1)
length += 1 // type byte
length += len(subpacket.contents)
}
}
return
} | [
"func",
"subpacketsLength",
"(",
"subpackets",
"[",
"]",
"outputSubpacket",
",",
"hashed",
"bool",
")",
"(",
"length",
"int",
")",
"{",
"for",
"_",
",",
"subpacket",
":=",
"range",
"subpackets",
"{",
"if",
"subpacket",
".",
"hashed",
"==",
"hashed",
"{",
... | // subpacketsLength returns the serialized length, in bytes, of the given
// subpackets. | [
"subpacketsLength",
"returns",
"the",
"serialized",
"length",
"in",
"bytes",
"of",
"the",
"given",
"subpackets",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/signature.go#L430-L439 |
149,921 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/signature.go | serializeSubpackets | func serializeSubpackets(to []byte, subpackets []outputSubpacket, hashed bool) {
for _, subpacket := range subpackets {
if subpacket.hashed == hashed {
n := serializeSubpacketLength(to, len(subpacket.contents)+1)
to[n] = byte(subpacket.subpacketType)
to = to[1+n:]
n = copy(to, subpacket.contents)
to =... | go | func serializeSubpackets(to []byte, subpackets []outputSubpacket, hashed bool) {
for _, subpacket := range subpackets {
if subpacket.hashed == hashed {
n := serializeSubpacketLength(to, len(subpacket.contents)+1)
to[n] = byte(subpacket.subpacketType)
to = to[1+n:]
n = copy(to, subpacket.contents)
to =... | [
"func",
"serializeSubpackets",
"(",
"to",
"[",
"]",
"byte",
",",
"subpackets",
"[",
"]",
"outputSubpacket",
",",
"hashed",
"bool",
")",
"{",
"for",
"_",
",",
"subpacket",
":=",
"range",
"subpackets",
"{",
"if",
"subpacket",
".",
"hashed",
"==",
"hashed",
... | // serializeSubpackets marshals the given subpackets into to. | [
"serializeSubpackets",
"marshals",
"the",
"given",
"subpackets",
"into",
"to",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/signature.go#L442-L453 |
149,922 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/signature.go | KeyExpired | func (sig *Signature) KeyExpired(currentTime time.Time) bool {
if sig.KeyLifetimeSecs == nil {
return false
}
expiry := sig.CreationTime.Add(time.Duration(*sig.KeyLifetimeSecs) * time.Second)
return currentTime.After(expiry)
} | go | func (sig *Signature) KeyExpired(currentTime time.Time) bool {
if sig.KeyLifetimeSecs == nil {
return false
}
expiry := sig.CreationTime.Add(time.Duration(*sig.KeyLifetimeSecs) * time.Second)
return currentTime.After(expiry)
} | [
"func",
"(",
"sig",
"*",
"Signature",
")",
"KeyExpired",
"(",
"currentTime",
"time",
".",
"Time",
")",
"bool",
"{",
"if",
"sig",
".",
"KeyLifetimeSecs",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"expiry",
":=",
"sig",
".",
"CreationTime",
"... | // KeyExpired returns whether sig is a self-signature of a key that has
// expired. | [
"KeyExpired",
"returns",
"whether",
"sig",
"is",
"a",
"self",
"-",
"signature",
"of",
"a",
"key",
"that",
"has",
"expired",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/signature.go#L457-L463 |
149,923 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/signature.go | buildHashSuffix | func (sig *Signature) buildHashSuffix() (err error) {
hashedSubpacketsLen := subpacketsLength(sig.outSubpackets, true)
var ok bool
l := 6 + hashedSubpacketsLen
sig.HashSuffix = make([]byte, l+6)
sig.HashSuffix[0] = 4
sig.HashSuffix[1] = uint8(sig.SigType)
sig.HashSuffix[2] = uint8(sig.PubKeyAlgo)
sig.HashSuffi... | go | func (sig *Signature) buildHashSuffix() (err error) {
hashedSubpacketsLen := subpacketsLength(sig.outSubpackets, true)
var ok bool
l := 6 + hashedSubpacketsLen
sig.HashSuffix = make([]byte, l+6)
sig.HashSuffix[0] = 4
sig.HashSuffix[1] = uint8(sig.SigType)
sig.HashSuffix[2] = uint8(sig.PubKeyAlgo)
sig.HashSuffi... | [
"func",
"(",
"sig",
"*",
"Signature",
")",
"buildHashSuffix",
"(",
")",
"(",
"err",
"error",
")",
"{",
"hashedSubpacketsLen",
":=",
"subpacketsLength",
"(",
"sig",
".",
"outSubpackets",
",",
"true",
")",
"\n\n",
"var",
"ok",
"bool",
"\n",
"l",
":=",
"6",... | // buildHashSuffix constructs the HashSuffix member of sig in preparation for signing. | [
"buildHashSuffix",
"constructs",
"the",
"HashSuffix",
"member",
"of",
"sig",
"in",
"preparation",
"for",
"signing",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/signature.go#L466-L491 |
149,924 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/signature.go | Sign | func (sig *Signature) Sign(h hash.Hash, priv *PrivateKey, config *Config) (err error) {
sig.outSubpackets = sig.buildSubpackets()
digest, err := sig.signPrepareHash(h)
if err != nil {
return
}
switch priv.PubKeyAlgo {
case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly:
sig.RSASignature.bytes, err = rsa.SignPKCS1v15(c... | go | func (sig *Signature) Sign(h hash.Hash, priv *PrivateKey, config *Config) (err error) {
sig.outSubpackets = sig.buildSubpackets()
digest, err := sig.signPrepareHash(h)
if err != nil {
return
}
switch priv.PubKeyAlgo {
case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly:
sig.RSASignature.bytes, err = rsa.SignPKCS1v15(c... | [
"func",
"(",
"sig",
"*",
"Signature",
")",
"Sign",
"(",
"h",
"hash",
".",
"Hash",
",",
"priv",
"*",
"PrivateKey",
",",
"config",
"*",
"Config",
")",
"(",
"err",
"error",
")",
"{",
"sig",
".",
"outSubpackets",
"=",
"sig",
".",
"buildSubpackets",
"(",
... | // Sign signs a message with a private key. The hash, h, must contain
// the hash of the message to be signed and will be mutated by this function.
// On success, the signature is stored in sig. Call Serialize to write it out.
// If config is nil, sensible defaults will be used. | [
"Sign",
"signs",
"a",
"message",
"with",
"a",
"private",
"key",
".",
"The",
"hash",
"h",
"must",
"contain",
"the",
"hash",
"of",
"the",
"message",
"to",
"be",
"signed",
"and",
"will",
"be",
"mutated",
"by",
"this",
"function",
".",
"On",
"success",
"th... | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/signature.go#L509-L540 |
149,925 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/signature.go | SignUserId | func (sig *Signature) SignUserId(id string, pub *PublicKey, priv *PrivateKey, config *Config) error {
h, err := userIdSignatureHash(id, pub, sig.Hash)
if err != nil {
return nil
}
return sig.Sign(h, priv, config)
} | go | func (sig *Signature) SignUserId(id string, pub *PublicKey, priv *PrivateKey, config *Config) error {
h, err := userIdSignatureHash(id, pub, sig.Hash)
if err != nil {
return nil
}
return sig.Sign(h, priv, config)
} | [
"func",
"(",
"sig",
"*",
"Signature",
")",
"SignUserId",
"(",
"id",
"string",
",",
"pub",
"*",
"PublicKey",
",",
"priv",
"*",
"PrivateKey",
",",
"config",
"*",
"Config",
")",
"error",
"{",
"h",
",",
"err",
":=",
"userIdSignatureHash",
"(",
"id",
",",
... | // SignUserId computes a signature from priv, asserting that pub is a valid
// key for the identity id. On success, the signature is stored in sig. Call
// Serialize to write it out.
// If config is nil, sensible defaults will be used. | [
"SignUserId",
"computes",
"a",
"signature",
"from",
"priv",
"asserting",
"that",
"pub",
"is",
"a",
"valid",
"key",
"for",
"the",
"identity",
"id",
".",
"On",
"success",
"the",
"signature",
"is",
"stored",
"in",
"sig",
".",
"Call",
"Serialize",
"to",
"write... | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/signature.go#L546-L552 |
149,926 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/signature.go | SignKey | func (sig *Signature) SignKey(pub *PublicKey, priv *PrivateKey, config *Config) error {
h, err := keySignatureHash(&priv.PublicKey, pub, sig.Hash)
if err != nil {
return err
}
return sig.Sign(h, priv, config)
} | go | func (sig *Signature) SignKey(pub *PublicKey, priv *PrivateKey, config *Config) error {
h, err := keySignatureHash(&priv.PublicKey, pub, sig.Hash)
if err != nil {
return err
}
return sig.Sign(h, priv, config)
} | [
"func",
"(",
"sig",
"*",
"Signature",
")",
"SignKey",
"(",
"pub",
"*",
"PublicKey",
",",
"priv",
"*",
"PrivateKey",
",",
"config",
"*",
"Config",
")",
"error",
"{",
"h",
",",
"err",
":=",
"keySignatureHash",
"(",
"&",
"priv",
".",
"PublicKey",
",",
"... | // SignKey computes a signature from priv, asserting that pub is a subkey. On
// success, the signature is stored in sig. Call Serialize to write it out.
// If config is nil, sensible defaults will be used. | [
"SignKey",
"computes",
"a",
"signature",
"from",
"priv",
"asserting",
"that",
"pub",
"is",
"a",
"subkey",
".",
"On",
"success",
"the",
"signature",
"is",
"stored",
"in",
"sig",
".",
"Call",
"Serialize",
"to",
"write",
"it",
"out",
".",
"If",
"config",
"i... | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/signature.go#L557-L563 |
149,927 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/one_pass_signature.go | Serialize | func (ops *OnePassSignature) Serialize(w io.Writer) error {
var buf [13]byte
buf[0] = onePassSignatureVersion
buf[1] = uint8(ops.SigType)
var ok bool
buf[2], ok = s2k.HashToHashId(ops.Hash)
if !ok {
return errors.UnsupportedError("hash type: " + strconv.Itoa(int(ops.Hash)))
}
buf[3] = uint8(ops.PubKeyAlgo)
b... | go | func (ops *OnePassSignature) Serialize(w io.Writer) error {
var buf [13]byte
buf[0] = onePassSignatureVersion
buf[1] = uint8(ops.SigType)
var ok bool
buf[2], ok = s2k.HashToHashId(ops.Hash)
if !ok {
return errors.UnsupportedError("hash type: " + strconv.Itoa(int(ops.Hash)))
}
buf[3] = uint8(ops.PubKeyAlgo)
b... | [
"func",
"(",
"ops",
"*",
"OnePassSignature",
")",
"Serialize",
"(",
"w",
"io",
".",
"Writer",
")",
"error",
"{",
"var",
"buf",
"[",
"13",
"]",
"byte",
"\n",
"buf",
"[",
"0",
"]",
"=",
"onePassSignatureVersion",
"\n",
"buf",
"[",
"1",
"]",
"=",
"uin... | // Serialize marshals the given OnePassSignature to w. | [
"Serialize",
"marshals",
"the",
"given",
"OnePassSignature",
"to",
"w",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/one_pass_signature.go#L53-L73 |
149,928 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/reader.go | Next | func (r *Reader) Next() (p Packet, err error) {
if len(r.q) > 0 {
p = r.q[len(r.q)-1]
r.q = r.q[:len(r.q)-1]
return
}
for len(r.readers) > 0 {
p, err = Read(r.readers[len(r.readers)-1])
if err == nil {
return
}
if err == io.EOF {
r.readers = r.readers[:len(r.readers)-1]
continue
}
if _, o... | go | func (r *Reader) Next() (p Packet, err error) {
if len(r.q) > 0 {
p = r.q[len(r.q)-1]
r.q = r.q[:len(r.q)-1]
return
}
for len(r.readers) > 0 {
p, err = Read(r.readers[len(r.readers)-1])
if err == nil {
return
}
if err == io.EOF {
r.readers = r.readers[:len(r.readers)-1]
continue
}
if _, o... | [
"func",
"(",
"r",
"*",
"Reader",
")",
"Next",
"(",
")",
"(",
"p",
"Packet",
",",
"err",
"error",
")",
"{",
"if",
"len",
"(",
"r",
".",
"q",
")",
">",
"0",
"{",
"p",
"=",
"r",
".",
"q",
"[",
"len",
"(",
"r",
".",
"q",
")",
"-",
"1",
"]... | // Next returns the most recently unread Packet, or reads another packet from
// the top-most io.Reader. Unknown packet types are skipped. | [
"Next",
"returns",
"the",
"most",
"recently",
"unread",
"Packet",
"or",
"reads",
"another",
"packet",
"from",
"the",
"top",
"-",
"most",
"io",
".",
"Reader",
".",
"Unknown",
"packet",
"types",
"are",
"skipped",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/reader.go#L29-L51 |
149,929 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/reader.go | Push | func (r *Reader) Push(reader io.Reader) (err error) {
if len(r.readers) >= maxReaders {
return errors.StructuralError("too many layers of packets")
}
r.readers = append(r.readers, reader)
return nil
} | go | func (r *Reader) Push(reader io.Reader) (err error) {
if len(r.readers) >= maxReaders {
return errors.StructuralError("too many layers of packets")
}
r.readers = append(r.readers, reader)
return nil
} | [
"func",
"(",
"r",
"*",
"Reader",
")",
"Push",
"(",
"reader",
"io",
".",
"Reader",
")",
"(",
"err",
"error",
")",
"{",
"if",
"len",
"(",
"r",
".",
"readers",
")",
">=",
"maxReaders",
"{",
"return",
"errors",
".",
"StructuralError",
"(",
"\"",
"\"",
... | // Push causes the Reader to start reading from a new io.Reader. When an EOF
// error is seen from the new io.Reader, it is popped and the Reader continues
// to read from the next most recent io.Reader. Push returns a StructuralError
// if pushing the reader would exceed the maximum recursion level, otherwise it
// re... | [
"Push",
"causes",
"the",
"Reader",
"to",
"start",
"reading",
"from",
"a",
"new",
"io",
".",
"Reader",
".",
"When",
"an",
"EOF",
"error",
"is",
"seen",
"from",
"the",
"new",
"io",
".",
"Reader",
"it",
"is",
"popped",
"and",
"the",
"Reader",
"continues",... | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/reader.go#L58-L64 |
149,930 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/reader.go | Unread | func (r *Reader) Unread(p Packet) {
r.q = append(r.q, p)
} | go | func (r *Reader) Unread(p Packet) {
r.q = append(r.q, p)
} | [
"func",
"(",
"r",
"*",
"Reader",
")",
"Unread",
"(",
"p",
"Packet",
")",
"{",
"r",
".",
"q",
"=",
"append",
"(",
"r",
".",
"q",
",",
"p",
")",
"\n",
"}"
] | // Unread causes the given Packet to be returned from the next call to Next. | [
"Unread",
"causes",
"the",
"given",
"Packet",
"to",
"be",
"returned",
"from",
"the",
"next",
"call",
"to",
"Next",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/reader.go#L67-L69 |
149,931 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/ocfb.go | NewOCFBEncrypter | func NewOCFBEncrypter(block cipher.Block, randData []byte, resync OCFBResyncOption) (cipher.Stream, []byte) {
blockSize := block.BlockSize()
if len(randData) != blockSize {
return nil, nil
}
x := &ocfbEncrypter{
b: block,
fre: make([]byte, blockSize),
outUsed: 0,
}
prefix := make([]byte, blockS... | go | func NewOCFBEncrypter(block cipher.Block, randData []byte, resync OCFBResyncOption) (cipher.Stream, []byte) {
blockSize := block.BlockSize()
if len(randData) != blockSize {
return nil, nil
}
x := &ocfbEncrypter{
b: block,
fre: make([]byte, blockSize),
outUsed: 0,
}
prefix := make([]byte, blockS... | [
"func",
"NewOCFBEncrypter",
"(",
"block",
"cipher",
".",
"Block",
",",
"randData",
"[",
"]",
"byte",
",",
"resync",
"OCFBResyncOption",
")",
"(",
"cipher",
".",
"Stream",
",",
"[",
"]",
"byte",
")",
"{",
"blockSize",
":=",
"block",
".",
"BlockSize",
"(",... | // NewOCFBEncrypter returns a cipher.Stream which encrypts data with OpenPGP's
// cipher feedback mode using the given cipher.Block, and an initial amount of
// ciphertext. randData must be random bytes and be the same length as the
// cipher.Block's block size. Resync determines if the "resynchronization step"
// fro... | [
"NewOCFBEncrypter",
"returns",
"a",
"cipher",
".",
"Stream",
"which",
"encrypts",
"data",
"with",
"OpenPGP",
"s",
"cipher",
"feedback",
"mode",
"using",
"the",
"given",
"cipher",
".",
"Block",
"and",
"an",
"initial",
"amount",
"of",
"ciphertext",
".",
"randDat... | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/ocfb.go#L34-L64 |
149,932 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/ocfb.go | NewOCFBDecrypter | func NewOCFBDecrypter(block cipher.Block, prefix []byte, resync OCFBResyncOption) cipher.Stream {
blockSize := block.BlockSize()
if len(prefix) != blockSize+2 {
return nil
}
x := &ocfbDecrypter{
b: block,
fre: make([]byte, blockSize),
outUsed: 0,
}
prefixCopy := make([]byte, len(prefix))
copy(... | go | func NewOCFBDecrypter(block cipher.Block, prefix []byte, resync OCFBResyncOption) cipher.Stream {
blockSize := block.BlockSize()
if len(prefix) != blockSize+2 {
return nil
}
x := &ocfbDecrypter{
b: block,
fre: make([]byte, blockSize),
outUsed: 0,
}
prefixCopy := make([]byte, len(prefix))
copy(... | [
"func",
"NewOCFBDecrypter",
"(",
"block",
"cipher",
".",
"Block",
",",
"prefix",
"[",
"]",
"byte",
",",
"resync",
"OCFBResyncOption",
")",
"cipher",
".",
"Stream",
"{",
"blockSize",
":=",
"block",
".",
"BlockSize",
"(",
")",
"\n",
"if",
"len",
"(",
"pref... | // NewOCFBDecrypter returns a cipher.Stream which decrypts data with OpenPGP's
// cipher feedback mode using the given cipher.Block. Prefix must be the first
// blockSize + 2 bytes of the ciphertext, where blockSize is the cipher.Block's
// block size. If an incorrect key is detected then nil is returned. On
// success... | [
"NewOCFBDecrypter",
"returns",
"a",
"cipher",
".",
"Stream",
"which",
"decrypts",
"data",
"with",
"OpenPGP",
"s",
"cipher",
"feedback",
"mode",
"using",
"the",
"given",
"cipher",
".",
"Block",
".",
"Prefix",
"must",
"be",
"the",
"first",
"blockSize",
"+",
"2... | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/ocfb.go#L92-L129 |
149,933 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/literal.go | SerializeLiteral | func SerializeLiteral(w io.WriteCloser, isBinary bool, fileName string, time uint32) (plaintext io.WriteCloser, err error) {
var buf [4]byte
buf[0] = 't'
if isBinary {
buf[0] = 'b'
}
if len(fileName) > 255 {
fileName = fileName[:255]
}
buf[1] = byte(len(fileName))
inner, err := serializeStreamHeader(w, pac... | go | func SerializeLiteral(w io.WriteCloser, isBinary bool, fileName string, time uint32) (plaintext io.WriteCloser, err error) {
var buf [4]byte
buf[0] = 't'
if isBinary {
buf[0] = 'b'
}
if len(fileName) > 255 {
fileName = fileName[:255]
}
buf[1] = byte(len(fileName))
inner, err := serializeStreamHeader(w, pac... | [
"func",
"SerializeLiteral",
"(",
"w",
"io",
".",
"WriteCloser",
",",
"isBinary",
"bool",
",",
"fileName",
"string",
",",
"time",
"uint32",
")",
"(",
"plaintext",
"io",
".",
"WriteCloser",
",",
"err",
"error",
")",
"{",
"var",
"buf",
"[",
"4",
"]",
"byt... | // SerializeLiteral serializes a literal data packet to w and returns a
// WriteCloser to which the data itself can be written and which MUST be closed
// on completion. The fileName is truncated to 255 bytes. | [
"SerializeLiteral",
"serializes",
"a",
"literal",
"data",
"packet",
"to",
"w",
"and",
"returns",
"a",
"WriteCloser",
"to",
"which",
"the",
"data",
"itself",
"can",
"be",
"written",
"and",
"which",
"MUST",
"be",
"closed",
"on",
"completion",
".",
"The",
"file... | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/literal.go#L57-L89 |
149,934 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go | readFull | func readFull(r io.Reader, buf []byte) (n int, err error) {
n, err = io.ReadFull(r, buf)
if err == io.EOF {
err = io.ErrUnexpectedEOF
}
return
} | go | func readFull(r io.Reader, buf []byte) (n int, err error) {
n, err = io.ReadFull(r, buf)
if err == io.EOF {
err = io.ErrUnexpectedEOF
}
return
} | [
"func",
"readFull",
"(",
"r",
"io",
".",
"Reader",
",",
"buf",
"[",
"]",
"byte",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"n",
",",
"err",
"=",
"io",
".",
"ReadFull",
"(",
"r",
",",
"buf",
")",
"\n",
"if",
"err",
"==",
"io",
"."... | // readFull is the same as io.ReadFull except that reading zero bytes returns
// ErrUnexpectedEOF rather than EOF. | [
"readFull",
"is",
"the",
"same",
"as",
"io",
".",
"ReadFull",
"except",
"that",
"reading",
"zero",
"bytes",
"returns",
"ErrUnexpectedEOF",
"rather",
"than",
"EOF",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go#L22-L28 |
149,935 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go | readLength | func readLength(r io.Reader) (length int64, isPartial bool, err error) {
var buf [4]byte
_, err = readFull(r, buf[:1])
if err != nil {
return
}
switch {
case buf[0] < 192:
length = int64(buf[0])
case buf[0] < 224:
length = int64(buf[0]-192) << 8
_, err = readFull(r, buf[0:1])
if err != nil {
return
... | go | func readLength(r io.Reader) (length int64, isPartial bool, err error) {
var buf [4]byte
_, err = readFull(r, buf[:1])
if err != nil {
return
}
switch {
case buf[0] < 192:
length = int64(buf[0])
case buf[0] < 224:
length = int64(buf[0]-192) << 8
_, err = readFull(r, buf[0:1])
if err != nil {
return
... | [
"func",
"readLength",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"length",
"int64",
",",
"isPartial",
"bool",
",",
"err",
"error",
")",
"{",
"var",
"buf",
"[",
"4",
"]",
"byte",
"\n",
"_",
",",
"err",
"=",
"readFull",
"(",
"r",
",",
"buf",
"[",
"... | // readLength reads an OpenPGP length from r. See RFC 4880, section 4.2.2. | [
"readLength",
"reads",
"an",
"OpenPGP",
"length",
"from",
"r",
".",
"See",
"RFC",
"4880",
"section",
"4",
".",
"2",
".",
"2",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go#L31-L61 |
149,936 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go | readHeader | func readHeader(r io.Reader) (tag packetType, length int64, contents io.Reader, err error) {
var buf [4]byte
_, err = io.ReadFull(r, buf[:1])
if err != nil {
return
}
if buf[0]&0x80 == 0 {
err = errors.StructuralError("tag byte does not have MSB set")
return
}
if buf[0]&0x40 == 0 {
// Old format packet
... | go | func readHeader(r io.Reader) (tag packetType, length int64, contents io.Reader, err error) {
var buf [4]byte
_, err = io.ReadFull(r, buf[:1])
if err != nil {
return
}
if buf[0]&0x80 == 0 {
err = errors.StructuralError("tag byte does not have MSB set")
return
}
if buf[0]&0x40 == 0 {
// Old format packet
... | [
"func",
"readHeader",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"tag",
"packetType",
",",
"length",
"int64",
",",
"contents",
"io",
".",
"Reader",
",",
"err",
"error",
")",
"{",
"var",
"buf",
"[",
"4",
"]",
"byte",
"\n",
"_",
",",
"err",
"=",
"io"... | // readHeader parses a packet header and returns an io.Reader which will return
// the contents of the packet. See RFC 4880, section 4.2. | [
"readHeader",
"parses",
"a",
"packet",
"header",
"and",
"returns",
"an",
"io",
".",
"Reader",
"which",
"will",
"return",
"the",
"contents",
"of",
"the",
"packet",
".",
"See",
"RFC",
"4880",
"section",
"4",
".",
"2",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go#L160-L209 |
149,937 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go | serializeHeader | func serializeHeader(w io.Writer, ptype packetType, length int) (err error) {
var buf [6]byte
var n int
buf[0] = 0x80 | 0x40 | byte(ptype)
if length < 192 {
buf[1] = byte(length)
n = 2
} else if length < 8384 {
length -= 192
buf[1] = 192 + byte(length>>8)
buf[2] = byte(length)
n = 3
} else {
buf[1]... | go | func serializeHeader(w io.Writer, ptype packetType, length int) (err error) {
var buf [6]byte
var n int
buf[0] = 0x80 | 0x40 | byte(ptype)
if length < 192 {
buf[1] = byte(length)
n = 2
} else if length < 8384 {
length -= 192
buf[1] = 192 + byte(length>>8)
buf[2] = byte(length)
n = 3
} else {
buf[1]... | [
"func",
"serializeHeader",
"(",
"w",
"io",
".",
"Writer",
",",
"ptype",
"packetType",
",",
"length",
"int",
")",
"(",
"err",
"error",
")",
"{",
"var",
"buf",
"[",
"6",
"]",
"byte",
"\n",
"var",
"n",
"int",
"\n\n",
"buf",
"[",
"0",
"]",
"=",
"0x80... | // serializeHeader writes an OpenPGP packet header to w. See RFC 4880, section
// 4.2. | [
"serializeHeader",
"writes",
"an",
"OpenPGP",
"packet",
"header",
"to",
"w",
".",
"See",
"RFC",
"4880",
"section",
"4",
".",
"2",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go#L213-L237 |
149,938 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go | serializeStreamHeader | func serializeStreamHeader(w io.WriteCloser, ptype packetType) (out io.WriteCloser, err error) {
var buf [1]byte
buf[0] = 0x80 | 0x40 | byte(ptype)
_, err = w.Write(buf[:])
if err != nil {
return
}
out = &partialLengthWriter{w: w}
return
} | go | func serializeStreamHeader(w io.WriteCloser, ptype packetType) (out io.WriteCloser, err error) {
var buf [1]byte
buf[0] = 0x80 | 0x40 | byte(ptype)
_, err = w.Write(buf[:])
if err != nil {
return
}
out = &partialLengthWriter{w: w}
return
} | [
"func",
"serializeStreamHeader",
"(",
"w",
"io",
".",
"WriteCloser",
",",
"ptype",
"packetType",
")",
"(",
"out",
"io",
".",
"WriteCloser",
",",
"err",
"error",
")",
"{",
"var",
"buf",
"[",
"1",
"]",
"byte",
"\n",
"buf",
"[",
"0",
"]",
"=",
"0x80",
... | // serializeStreamHeader writes an OpenPGP packet header to w where the
// length of the packet is unknown. It returns a io.WriteCloser which can be
// used to write the contents of the packet. See RFC 4880, section 4.2. | [
"serializeStreamHeader",
"writes",
"an",
"OpenPGP",
"packet",
"header",
"to",
"w",
"where",
"the",
"length",
"of",
"the",
"packet",
"is",
"unknown",
".",
"It",
"returns",
"a",
"io",
".",
"WriteCloser",
"which",
"can",
"be",
"used",
"to",
"write",
"the",
"c... | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go#L242-L251 |
149,939 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go | consumeAll | func consumeAll(r io.Reader) (n int64, err error) {
var m int
var buf [1024]byte
for {
m, err = r.Read(buf[:])
n += int64(m)
if err == io.EOF {
err = nil
return
}
if err != nil {
return
}
}
panic("unreachable")
} | go | func consumeAll(r io.Reader) (n int64, err error) {
var m int
var buf [1024]byte
for {
m, err = r.Read(buf[:])
n += int64(m)
if err == io.EOF {
err = nil
return
}
if err != nil {
return
}
}
panic("unreachable")
} | [
"func",
"consumeAll",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"n",
"int64",
",",
"err",
"error",
")",
"{",
"var",
"m",
"int",
"\n",
"var",
"buf",
"[",
"1024",
"]",
"byte",
"\n\n",
"for",
"{",
"m",
",",
"err",
"=",
"r",
".",
"Read",
"(",
"buf... | // consumeAll reads from the given Reader until error, returning the number of
// bytes read. | [
"consumeAll",
"reads",
"from",
"the",
"given",
"Reader",
"until",
"error",
"returning",
"the",
"number",
"of",
"bytes",
"read",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go#L261-L278 |
149,940 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go | peekVersion | func peekVersion(r io.Reader) (bufr *bufio.Reader, ver byte, err error) {
bufr = bufio.NewReader(r)
var verBuf []byte
if verBuf, err = bufr.Peek(1); err != nil {
return
}
ver = verBuf[0]
return
} | go | func peekVersion(r io.Reader) (bufr *bufio.Reader, ver byte, err error) {
bufr = bufio.NewReader(r)
var verBuf []byte
if verBuf, err = bufr.Peek(1); err != nil {
return
}
ver = verBuf[0]
return
} | [
"func",
"peekVersion",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"bufr",
"*",
"bufio",
".",
"Reader",
",",
"ver",
"byte",
",",
"err",
"error",
")",
"{",
"bufr",
"=",
"bufio",
".",
"NewReader",
"(",
"r",
")",
"\n",
"var",
"verBuf",
"[",
"]",
"byte"... | // peekVersion detects the version of a public key packet about to
// be read. A bufio.Reader at the original position of the io.Reader
// is returned. | [
"peekVersion",
"detects",
"the",
"version",
"of",
"a",
"public",
"key",
"packet",
"about",
"to",
"be",
"read",
".",
"A",
"bufio",
".",
"Reader",
"at",
"the",
"original",
"position",
"of",
"the",
"io",
".",
"Reader",
"is",
"returned",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go#L304-L312 |
149,941 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go | Read | func Read(r io.Reader) (p Packet, err error) {
tag, _, contents, err := readHeader(r)
if err != nil {
return
}
switch tag {
case packetTypeEncryptedKey:
p = new(EncryptedKey)
case packetTypeSignature:
var version byte
// Detect signature version
if contents, version, err = peekVersion(contents); err !=... | go | func Read(r io.Reader) (p Packet, err error) {
tag, _, contents, err := readHeader(r)
if err != nil {
return
}
switch tag {
case packetTypeEncryptedKey:
p = new(EncryptedKey)
case packetTypeSignature:
var version byte
// Detect signature version
if contents, version, err = peekVersion(contents); err !=... | [
"func",
"Read",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"p",
"Packet",
",",
"err",
"error",
")",
"{",
"tag",
",",
"_",
",",
"contents",
",",
"err",
":=",
"readHeader",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
... | // Read reads a single OpenPGP packet from the given io.Reader. If there is an
// error parsing a packet, the whole packet is consumed from the input. | [
"Read",
"reads",
"a",
"single",
"OpenPGP",
"packet",
"from",
"the",
"given",
"io",
".",
"Reader",
".",
"If",
"there",
"is",
"an",
"error",
"parsing",
"a",
"packet",
"the",
"whole",
"packet",
"is",
"consumed",
"from",
"the",
"input",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go#L316-L381 |
149,942 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go | CanEncrypt | func (pka PublicKeyAlgorithm) CanEncrypt() bool {
switch pka {
case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoElGamal:
return true
}
return false
} | go | func (pka PublicKeyAlgorithm) CanEncrypt() bool {
switch pka {
case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoElGamal:
return true
}
return false
} | [
"func",
"(",
"pka",
"PublicKeyAlgorithm",
")",
"CanEncrypt",
"(",
")",
"bool",
"{",
"switch",
"pka",
"{",
"case",
"PubKeyAlgoRSA",
",",
"PubKeyAlgoRSAEncryptOnly",
",",
"PubKeyAlgoElGamal",
":",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] | // CanEncrypt returns true if it's possible to encrypt a message to a public
// key of the given type. | [
"CanEncrypt",
"returns",
"true",
"if",
"it",
"s",
"possible",
"to",
"encrypt",
"a",
"message",
"to",
"a",
"public",
"key",
"of",
"the",
"given",
"type",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go#L419-L425 |
149,943 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go | KeySize | func (cipher CipherFunction) KeySize() int {
switch cipher {
case Cipher3DES:
return 24
case CipherCAST5:
return cast5.KeySize
case CipherAES128:
return 16
case CipherAES192:
return 24
case CipherAES256:
return 32
}
return 0
} | go | func (cipher CipherFunction) KeySize() int {
switch cipher {
case Cipher3DES:
return 24
case CipherCAST5:
return cast5.KeySize
case CipherAES128:
return 16
case CipherAES192:
return 24
case CipherAES256:
return 32
}
return 0
} | [
"func",
"(",
"cipher",
"CipherFunction",
")",
"KeySize",
"(",
")",
"int",
"{",
"switch",
"cipher",
"{",
"case",
"Cipher3DES",
":",
"return",
"24",
"\n",
"case",
"CipherCAST5",
":",
"return",
"cast5",
".",
"KeySize",
"\n",
"case",
"CipherAES128",
":",
"retu... | // KeySize returns the key size, in bytes, of cipher. | [
"KeySize",
"returns",
"the",
"key",
"size",
"in",
"bytes",
"of",
"cipher",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go#L450-L464 |
149,944 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go | blockSize | func (cipher CipherFunction) blockSize() int {
switch cipher {
case Cipher3DES:
return des.BlockSize
case CipherCAST5:
return 8
case CipherAES128, CipherAES192, CipherAES256:
return 16
}
return 0
} | go | func (cipher CipherFunction) blockSize() int {
switch cipher {
case Cipher3DES:
return des.BlockSize
case CipherCAST5:
return 8
case CipherAES128, CipherAES192, CipherAES256:
return 16
}
return 0
} | [
"func",
"(",
"cipher",
"CipherFunction",
")",
"blockSize",
"(",
")",
"int",
"{",
"switch",
"cipher",
"{",
"case",
"Cipher3DES",
":",
"return",
"des",
".",
"BlockSize",
"\n",
"case",
"CipherCAST5",
":",
"return",
"8",
"\n",
"case",
"CipherAES128",
",",
"Cip... | // blockSize returns the block size, in bytes, of cipher. | [
"blockSize",
"returns",
"the",
"block",
"size",
"in",
"bytes",
"of",
"cipher",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go#L467-L477 |
149,945 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go | new | func (cipher CipherFunction) new(key []byte) (block cipher.Block) {
switch cipher {
case Cipher3DES:
block, _ = des.NewTripleDESCipher(key)
case CipherCAST5:
block, _ = cast5.NewCipher(key)
case CipherAES128, CipherAES192, CipherAES256:
block, _ = aes.NewCipher(key)
}
return
} | go | func (cipher CipherFunction) new(key []byte) (block cipher.Block) {
switch cipher {
case Cipher3DES:
block, _ = des.NewTripleDESCipher(key)
case CipherCAST5:
block, _ = cast5.NewCipher(key)
case CipherAES128, CipherAES192, CipherAES256:
block, _ = aes.NewCipher(key)
}
return
} | [
"func",
"(",
"cipher",
"CipherFunction",
")",
"new",
"(",
"key",
"[",
"]",
"byte",
")",
"(",
"block",
"cipher",
".",
"Block",
")",
"{",
"switch",
"cipher",
"{",
"case",
"Cipher3DES",
":",
"block",
",",
"_",
"=",
"des",
".",
"NewTripleDESCipher",
"(",
... | // new returns a fresh instance of the given cipher. | [
"new",
"returns",
"a",
"fresh",
"instance",
"of",
"the",
"given",
"cipher",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go#L480-L490 |
149,946 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go | readMPI | func readMPI(r io.Reader) (mpi []byte, bitLength uint16, err error) {
var buf [2]byte
_, err = readFull(r, buf[0:])
if err != nil {
return
}
bitLength = uint16(buf[0])<<8 | uint16(buf[1])
numBytes := (int(bitLength) + 7) / 8
mpi = make([]byte, numBytes)
_, err = readFull(r, mpi)
return
} | go | func readMPI(r io.Reader) (mpi []byte, bitLength uint16, err error) {
var buf [2]byte
_, err = readFull(r, buf[0:])
if err != nil {
return
}
bitLength = uint16(buf[0])<<8 | uint16(buf[1])
numBytes := (int(bitLength) + 7) / 8
mpi = make([]byte, numBytes)
_, err = readFull(r, mpi)
return
} | [
"func",
"readMPI",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"mpi",
"[",
"]",
"byte",
",",
"bitLength",
"uint16",
",",
"err",
"error",
")",
"{",
"var",
"buf",
"[",
"2",
"]",
"byte",
"\n",
"_",
",",
"err",
"=",
"readFull",
"(",
"r",
",",
"buf",
... | // readMPI reads a big integer from r. The bit length returned is the bit
// length that was specified in r. This is preserved so that the integer can be
// reserialized exactly. | [
"readMPI",
"reads",
"a",
"big",
"integer",
"from",
"r",
".",
"The",
"bit",
"length",
"returned",
"is",
"the",
"bit",
"length",
"that",
"was",
"specified",
"in",
"r",
".",
"This",
"is",
"preserved",
"so",
"that",
"the",
"integer",
"can",
"be",
"reserializ... | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go#L495-L506 |
149,947 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go | writeMPI | func writeMPI(w io.Writer, bitLength uint16, mpiBytes []byte) (err error) {
_, err = w.Write([]byte{byte(bitLength >> 8), byte(bitLength)})
if err == nil {
_, err = w.Write(mpiBytes)
}
return
} | go | func writeMPI(w io.Writer, bitLength uint16, mpiBytes []byte) (err error) {
_, err = w.Write([]byte{byte(bitLength >> 8), byte(bitLength)})
if err == nil {
_, err = w.Write(mpiBytes)
}
return
} | [
"func",
"writeMPI",
"(",
"w",
"io",
".",
"Writer",
",",
"bitLength",
"uint16",
",",
"mpiBytes",
"[",
"]",
"byte",
")",
"(",
"err",
"error",
")",
"{",
"_",
",",
"err",
"=",
"w",
".",
"Write",
"(",
"[",
"]",
"byte",
"{",
"byte",
"(",
"bitLength",
... | // writeMPI serializes a big integer to w. | [
"writeMPI",
"serializes",
"a",
"big",
"integer",
"to",
"w",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/packet.go#L517-L523 |
149,948 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/symmetrically_encrypted.go | Decrypt | func (se *SymmetricallyEncrypted) Decrypt(c CipherFunction, key []byte) (io.ReadCloser, error) {
keySize := c.KeySize()
if keySize == 0 {
return nil, errors.UnsupportedError("unknown cipher: " + strconv.Itoa(int(c)))
}
if len(key) != keySize {
return nil, errors.InvalidArgumentError("SymmetricallyEncrypted: inc... | go | func (se *SymmetricallyEncrypted) Decrypt(c CipherFunction, key []byte) (io.ReadCloser, error) {
keySize := c.KeySize()
if keySize == 0 {
return nil, errors.UnsupportedError("unknown cipher: " + strconv.Itoa(int(c)))
}
if len(key) != keySize {
return nil, errors.InvalidArgumentError("SymmetricallyEncrypted: inc... | [
"func",
"(",
"se",
"*",
"SymmetricallyEncrypted",
")",
"Decrypt",
"(",
"c",
"CipherFunction",
",",
"key",
"[",
"]",
"byte",
")",
"(",
"io",
".",
"ReadCloser",
",",
"error",
")",
"{",
"keySize",
":=",
"c",
".",
"KeySize",
"(",
")",
"\n",
"if",
"keySiz... | // Decrypt returns a ReadCloser, from which the decrypted contents of the
// packet can be read. An incorrect key can, with high probability, be detected
// immediately and this will result in a KeyIncorrect error being returned. | [
"Decrypt",
"returns",
"a",
"ReadCloser",
"from",
"which",
"the",
"decrypted",
"contents",
"of",
"the",
"packet",
"can",
"be",
"read",
".",
"An",
"incorrect",
"key",
"can",
"with",
"high",
"probability",
"be",
"detected",
"immediately",
"and",
"this",
"will",
... | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/symmetrically_encrypted.go#L47-L88 |
149,949 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/symmetrically_encrypted.go | SerializeSymmetricallyEncrypted | func SerializeSymmetricallyEncrypted(w io.Writer, c CipherFunction, key []byte, config *Config) (contents io.WriteCloser, err error) {
if c.KeySize() != len(key) {
return nil, errors.InvalidArgumentError("SymmetricallyEncrypted.Serialize: bad key length")
}
writeCloser := noOpCloser{w}
ciphertext, err := serializ... | go | func SerializeSymmetricallyEncrypted(w io.Writer, c CipherFunction, key []byte, config *Config) (contents io.WriteCloser, err error) {
if c.KeySize() != len(key) {
return nil, errors.InvalidArgumentError("SymmetricallyEncrypted.Serialize: bad key length")
}
writeCloser := noOpCloser{w}
ciphertext, err := serializ... | [
"func",
"SerializeSymmetricallyEncrypted",
"(",
"w",
"io",
".",
"Writer",
",",
"c",
"CipherFunction",
",",
"key",
"[",
"]",
"byte",
",",
"config",
"*",
"Config",
")",
"(",
"contents",
"io",
".",
"WriteCloser",
",",
"err",
"error",
")",
"{",
"if",
"c",
... | // SerializeSymmetricallyEncrypted serializes a symmetrically encrypted packet
// to w and returns a WriteCloser to which the to-be-encrypted packets can be
// written.
// If config is nil, sensible defaults will be used. | [
"SerializeSymmetricallyEncrypted",
"serializes",
"a",
"symmetrically",
"encrypted",
"packet",
"to",
"w",
"and",
"returns",
"a",
"WriteCloser",
"to",
"which",
"the",
"to",
"-",
"be",
"-",
"encrypted",
"packets",
"can",
"be",
"written",
".",
"If",
"config",
"is",
... | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/symmetrically_encrypted.go#L256-L290 |
149,950 | lavab/mailer | Godeps/_workspace/src/code.google.com/p/goprotobuf/proto/encode.go | Marshal | func Marshal(pb Message) ([]byte, error) {
// Can the object marshal itself?
if m, ok := pb.(Marshaler); ok {
return m.Marshal()
}
p := NewBuffer(nil)
err := p.Marshal(pb)
var state errorState
if err != nil && !state.shouldContinue(err, nil) {
return nil, err
}
if p.buf == nil && err == nil {
// Return a... | go | func Marshal(pb Message) ([]byte, error) {
// Can the object marshal itself?
if m, ok := pb.(Marshaler); ok {
return m.Marshal()
}
p := NewBuffer(nil)
err := p.Marshal(pb)
var state errorState
if err != nil && !state.shouldContinue(err, nil) {
return nil, err
}
if p.buf == nil && err == nil {
// Return a... | [
"func",
"Marshal",
"(",
"pb",
"Message",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"// Can the object marshal itself?",
"if",
"m",
",",
"ok",
":=",
"pb",
".",
"(",
"Marshaler",
")",
";",
"ok",
"{",
"return",
"m",
".",
"Marshal",
"(",
")",
... | // Marshal takes the protocol buffer
// and encodes it into the wire format, returning the data. | [
"Marshal",
"takes",
"the",
"protocol",
"buffer",
"and",
"encodes",
"it",
"into",
"the",
"wire",
"format",
"returning",
"the",
"data",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/code.google.com/p/goprotobuf/proto/encode.go#L213-L229 |
149,951 | lavab/mailer | Godeps/_workspace/src/code.google.com/p/goprotobuf/proto/encode.go | Marshal | func (p *Buffer) Marshal(pb Message) error {
// Can the object marshal itself?
if m, ok := pb.(Marshaler); ok {
data, err := m.Marshal()
if err != nil {
return err
}
p.buf = append(p.buf, data...)
return nil
}
t, base, err := getbase(pb)
if structPointer_IsNil(base) {
return ErrNil
}
if err == ni... | go | func (p *Buffer) Marshal(pb Message) error {
// Can the object marshal itself?
if m, ok := pb.(Marshaler); ok {
data, err := m.Marshal()
if err != nil {
return err
}
p.buf = append(p.buf, data...)
return nil
}
t, base, err := getbase(pb)
if structPointer_IsNil(base) {
return ErrNil
}
if err == ni... | [
"func",
"(",
"p",
"*",
"Buffer",
")",
"Marshal",
"(",
"pb",
"Message",
")",
"error",
"{",
"// Can the object marshal itself?",
"if",
"m",
",",
"ok",
":=",
"pb",
".",
"(",
"Marshaler",
")",
";",
"ok",
"{",
"data",
",",
"err",
":=",
"m",
".",
"Marshal"... | // Marshal takes the protocol buffer
// and encodes it into the wire format, writing the result to the
// Buffer. | [
"Marshal",
"takes",
"the",
"protocol",
"buffer",
"and",
"encodes",
"it",
"into",
"the",
"wire",
"format",
"writing",
"the",
"result",
"to",
"the",
"Buffer",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/code.google.com/p/goprotobuf/proto/encode.go#L234-L258 |
149,952 | lavab/mailer | Godeps/_workspace/src/code.google.com/p/goprotobuf/proto/encode.go | Size | func Size(pb Message) (n int) {
// Can the object marshal itself? If so, Size is slow.
// TODO: add Size to Marshaler, or add a Sizer interface.
if m, ok := pb.(Marshaler); ok {
b, _ := m.Marshal()
return len(b)
}
t, base, err := getbase(pb)
if structPointer_IsNil(base) {
return 0
}
if err == nil {
n ... | go | func Size(pb Message) (n int) {
// Can the object marshal itself? If so, Size is slow.
// TODO: add Size to Marshaler, or add a Sizer interface.
if m, ok := pb.(Marshaler); ok {
b, _ := m.Marshal()
return len(b)
}
t, base, err := getbase(pb)
if structPointer_IsNil(base) {
return 0
}
if err == nil {
n ... | [
"func",
"Size",
"(",
"pb",
"Message",
")",
"(",
"n",
"int",
")",
"{",
"// Can the object marshal itself? If so, Size is slow.",
"// TODO: add Size to Marshaler, or add a Sizer interface.",
"if",
"m",
",",
"ok",
":=",
"pb",
".",
"(",
"Marshaler",
")",
";",
"ok",
"{"... | // Size returns the encoded size of a protocol buffer. | [
"Size",
"returns",
"the",
"encoded",
"size",
"of",
"a",
"protocol",
"buffer",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/code.google.com/p/goprotobuf/proto/encode.go#L261-L282 |
149,953 | lavab/mailer | Godeps/_workspace/src/code.google.com/p/goprotobuf/proto/encode.go | enc_int64 | func (o *Buffer) enc_int64(p *Properties, base structPointer) error {
v := structPointer_Word64(base, p.field)
if word64_IsNil(v) {
return ErrNil
}
x := word64_Get(v)
o.buf = append(o.buf, p.tagcode...)
p.valEnc(o, x)
return nil
} | go | func (o *Buffer) enc_int64(p *Properties, base structPointer) error {
v := structPointer_Word64(base, p.field)
if word64_IsNil(v) {
return ErrNil
}
x := word64_Get(v)
o.buf = append(o.buf, p.tagcode...)
p.valEnc(o, x)
return nil
} | [
"func",
"(",
"o",
"*",
"Buffer",
")",
"enc_int64",
"(",
"p",
"*",
"Properties",
",",
"base",
"structPointer",
")",
"error",
"{",
"v",
":=",
"structPointer_Word64",
"(",
"base",
",",
"p",
".",
"field",
")",
"\n",
"if",
"word64_IsNil",
"(",
"v",
")",
"... | // Encode an int64. | [
"Encode",
"an",
"int64",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/code.google.com/p/goprotobuf/proto/encode.go#L357-L366 |
149,954 | lavab/mailer | Godeps/_workspace/src/code.google.com/p/goprotobuf/proto/encode.go | enc_string | func (o *Buffer) enc_string(p *Properties, base structPointer) error {
v := *structPointer_String(base, p.field)
if v == nil {
return ErrNil
}
x := *v
o.buf = append(o.buf, p.tagcode...)
o.EncodeStringBytes(x)
return nil
} | go | func (o *Buffer) enc_string(p *Properties, base structPointer) error {
v := *structPointer_String(base, p.field)
if v == nil {
return ErrNil
}
x := *v
o.buf = append(o.buf, p.tagcode...)
o.EncodeStringBytes(x)
return nil
} | [
"func",
"(",
"o",
"*",
"Buffer",
")",
"enc_string",
"(",
"p",
"*",
"Properties",
",",
"base",
"structPointer",
")",
"error",
"{",
"v",
":=",
"*",
"structPointer_String",
"(",
"base",
",",
"p",
".",
"field",
")",
"\n",
"if",
"v",
"==",
"nil",
"{",
"... | // Encode a string. | [
"Encode",
"a",
"string",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/code.google.com/p/goprotobuf/proto/encode.go#L380-L389 |
149,955 | lavab/mailer | Godeps/_workspace/src/code.google.com/p/goprotobuf/proto/encode.go | enc_map | func (o *Buffer) enc_map(p *Properties, base structPointer) error {
v := *structPointer_ExtMap(base, p.field)
if err := encodeExtensionMap(v); err != nil {
return err
}
// Fast-path for common cases: zero or one extensions.
if len(v) <= 1 {
for _, e := range v {
o.buf = append(o.buf, e.enc...)
}
return ... | go | func (o *Buffer) enc_map(p *Properties, base structPointer) error {
v := *structPointer_ExtMap(base, p.field)
if err := encodeExtensionMap(v); err != nil {
return err
}
// Fast-path for common cases: zero or one extensions.
if len(v) <= 1 {
for _, e := range v {
o.buf = append(o.buf, e.enc...)
}
return ... | [
"func",
"(",
"o",
"*",
"Buffer",
")",
"enc_map",
"(",
"p",
"*",
"Properties",
",",
"base",
"structPointer",
")",
"error",
"{",
"v",
":=",
"*",
"structPointer_ExtMap",
"(",
"base",
",",
"p",
".",
"field",
")",
"\n",
"if",
"err",
":=",
"encodeExtensionMa... | // Encode an extension map. | [
"Encode",
"an",
"extension",
"map",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/code.google.com/p/goprotobuf/proto/encode.go#L917-L941 |
149,956 | lavab/mailer | Godeps/_workspace/src/code.google.com/p/goprotobuf/proto/encode.go | enc_struct | func (o *Buffer) enc_struct(prop *StructProperties, base structPointer) error {
var state errorState
// Encode fields in tag order so that decoders may use optimizations
// that depend on the ordering.
// http://code.google.com/apis/protocolbuffers/docs/encoding.html#order
for _, i := range prop.order {
p := pro... | go | func (o *Buffer) enc_struct(prop *StructProperties, base structPointer) error {
var state errorState
// Encode fields in tag order so that decoders may use optimizations
// that depend on the ordering.
// http://code.google.com/apis/protocolbuffers/docs/encoding.html#order
for _, i := range prop.order {
p := pro... | [
"func",
"(",
"o",
"*",
"Buffer",
")",
"enc_struct",
"(",
"prop",
"*",
"StructProperties",
",",
"base",
"structPointer",
")",
"error",
"{",
"var",
"state",
"errorState",
"\n",
"// Encode fields in tag order so that decoders may use optimizations",
"// that depend on the or... | // Encode a struct. | [
"Encode",
"a",
"struct",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/code.google.com/p/goprotobuf/proto/encode.go#L949-L979 |
149,957 | lavab/mailer | Godeps/_workspace/src/code.google.com/p/goprotobuf/proto/encode.go | shouldContinue | func (s *errorState) shouldContinue(err error, prop *Properties) bool {
// Ignore unset required fields.
reqNotSet, ok := err.(*RequiredNotSetError)
if !ok {
return false
}
if s.err == nil {
if prop != nil {
err = &RequiredNotSetError{prop.Name + "." + reqNotSet.field}
}
s.err = err
}
return true
} | go | func (s *errorState) shouldContinue(err error, prop *Properties) bool {
// Ignore unset required fields.
reqNotSet, ok := err.(*RequiredNotSetError)
if !ok {
return false
}
if s.err == nil {
if prop != nil {
err = &RequiredNotSetError{prop.Name + "." + reqNotSet.field}
}
s.err = err
}
return true
} | [
"func",
"(",
"s",
"*",
"errorState",
")",
"shouldContinue",
"(",
"err",
"error",
",",
"prop",
"*",
"Properties",
")",
"bool",
"{",
"// Ignore unset required fields.",
"reqNotSet",
",",
"ok",
":=",
"err",
".",
"(",
"*",
"RequiredNotSetError",
")",
"\n",
"if",... | // shouldContinue reports whether encoding should continue upon encountering the
// given error. If the error is RequiredNotSetError, shouldContinue returns true
// and, if this is the first appearance of that error, remembers it for future
// reporting.
//
// If prop is not nil, it may update any error with additional... | [
"shouldContinue",
"reports",
"whether",
"encoding",
"should",
"continue",
"upon",
"encountering",
"the",
"given",
"error",
".",
"If",
"the",
"error",
"is",
"RequiredNotSetError",
"shouldContinue",
"returns",
"true",
"and",
"if",
"this",
"is",
"the",
"first",
"appe... | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/code.google.com/p/goprotobuf/proto/encode.go#L1041-L1054 |
149,958 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/opaque.go | Serialize | func (op *OpaquePacket) Serialize(w io.Writer) (err error) {
err = serializeHeader(w, packetType(op.Tag), len(op.Contents))
if err == nil {
_, err = w.Write(op.Contents)
}
return
} | go | func (op *OpaquePacket) Serialize(w io.Writer) (err error) {
err = serializeHeader(w, packetType(op.Tag), len(op.Contents))
if err == nil {
_, err = w.Write(op.Contents)
}
return
} | [
"func",
"(",
"op",
"*",
"OpaquePacket",
")",
"Serialize",
"(",
"w",
"io",
".",
"Writer",
")",
"(",
"err",
"error",
")",
"{",
"err",
"=",
"serializeHeader",
"(",
"w",
",",
"packetType",
"(",
"op",
".",
"Tag",
")",
",",
"len",
"(",
"op",
".",
"Cont... | // Serialize marshals the packet to a writer in its original form, including
// the packet header. | [
"Serialize",
"marshals",
"the",
"packet",
"to",
"a",
"writer",
"in",
"its",
"original",
"form",
"including",
"the",
"packet",
"header",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/opaque.go#L34-L40 |
149,959 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/opaque.go | Parse | func (op *OpaquePacket) Parse() (p Packet, err error) {
hdr := bytes.NewBuffer(nil)
err = serializeHeader(hdr, packetType(op.Tag), len(op.Contents))
if err != nil {
op.Reason = err
return op, err
}
p, err = Read(io.MultiReader(hdr, bytes.NewBuffer(op.Contents)))
if err != nil {
op.Reason = err
p = op
}
... | go | func (op *OpaquePacket) Parse() (p Packet, err error) {
hdr := bytes.NewBuffer(nil)
err = serializeHeader(hdr, packetType(op.Tag), len(op.Contents))
if err != nil {
op.Reason = err
return op, err
}
p, err = Read(io.MultiReader(hdr, bytes.NewBuffer(op.Contents)))
if err != nil {
op.Reason = err
p = op
}
... | [
"func",
"(",
"op",
"*",
"OpaquePacket",
")",
"Parse",
"(",
")",
"(",
"p",
"Packet",
",",
"err",
"error",
")",
"{",
"hdr",
":=",
"bytes",
".",
"NewBuffer",
"(",
"nil",
")",
"\n",
"err",
"=",
"serializeHeader",
"(",
"hdr",
",",
"packetType",
"(",
"op... | // Parse attempts to parse the opaque contents into a structure supported by
// this package. If the packet is not known then the result will be another
// OpaquePacket. | [
"Parse",
"attempts",
"to",
"parse",
"the",
"opaque",
"contents",
"into",
"a",
"structure",
"supported",
"by",
"this",
"package",
".",
"If",
"the",
"packet",
"is",
"not",
"known",
"then",
"the",
"result",
"will",
"be",
"another",
"OpaquePacket",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/opaque.go#L45-L58 |
149,960 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/opaque.go | Next | func (or *OpaqueReader) Next() (op *OpaquePacket, err error) {
tag, _, contents, err := readHeader(or.r)
if err != nil {
return
}
op = &OpaquePacket{Tag: uint8(tag), Reason: err}
err = op.parse(contents)
if err != nil {
consumeAll(contents)
}
return
} | go | func (or *OpaqueReader) Next() (op *OpaquePacket, err error) {
tag, _, contents, err := readHeader(or.r)
if err != nil {
return
}
op = &OpaquePacket{Tag: uint8(tag), Reason: err}
err = op.parse(contents)
if err != nil {
consumeAll(contents)
}
return
} | [
"func",
"(",
"or",
"*",
"OpaqueReader",
")",
"Next",
"(",
")",
"(",
"op",
"*",
"OpaquePacket",
",",
"err",
"error",
")",
"{",
"tag",
",",
"_",
",",
"contents",
",",
"err",
":=",
"readHeader",
"(",
"or",
".",
"r",
")",
"\n",
"if",
"err",
"!=",
"... | // Read the next OpaquePacket. | [
"Read",
"the",
"next",
"OpaquePacket",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/opaque.go#L70-L81 |
149,961 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/opaque.go | OpaqueSubpackets | func OpaqueSubpackets(contents []byte) (result []*OpaqueSubpacket, err error) {
var (
subHeaderLen int
subPacket *OpaqueSubpacket
)
for len(contents) > 0 {
subHeaderLen, subPacket, err = nextSubpacket(contents)
if err != nil {
break
}
result = append(result, subPacket)
contents = contents[subHead... | go | func OpaqueSubpackets(contents []byte) (result []*OpaqueSubpacket, err error) {
var (
subHeaderLen int
subPacket *OpaqueSubpacket
)
for len(contents) > 0 {
subHeaderLen, subPacket, err = nextSubpacket(contents)
if err != nil {
break
}
result = append(result, subPacket)
contents = contents[subHead... | [
"func",
"OpaqueSubpackets",
"(",
"contents",
"[",
"]",
"byte",
")",
"(",
"result",
"[",
"]",
"*",
"OpaqueSubpacket",
",",
"err",
"error",
")",
"{",
"var",
"(",
"subHeaderLen",
"int",
"\n",
"subPacket",
"*",
"OpaqueSubpacket",
"\n",
")",
"\n",
"for",
"len... | // OpaqueSubpackets extracts opaque, unparsed OpenPGP subpackets from
// their byte representation. | [
"OpaqueSubpackets",
"extracts",
"opaque",
"unparsed",
"OpenPGP",
"subpackets",
"from",
"their",
"byte",
"representation",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/opaque.go#L92-L106 |
149,962 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/armor/armor.go | crc24 | func crc24(crc uint32, d []byte) uint32 {
for _, b := range d {
crc ^= uint32(b) << 16
for i := 0; i < 8; i++ {
crc <<= 1
if crc&0x1000000 != 0 {
crc ^= crc24Poly
}
}
}
return crc
} | go | func crc24(crc uint32, d []byte) uint32 {
for _, b := range d {
crc ^= uint32(b) << 16
for i := 0; i < 8; i++ {
crc <<= 1
if crc&0x1000000 != 0 {
crc ^= crc24Poly
}
}
}
return crc
} | [
"func",
"crc24",
"(",
"crc",
"uint32",
",",
"d",
"[",
"]",
"byte",
")",
"uint32",
"{",
"for",
"_",
",",
"b",
":=",
"range",
"d",
"{",
"crc",
"^=",
"uint32",
"(",
"b",
")",
"<<",
"16",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"8",
";",
... | // crc24 calculates the OpenPGP checksum as specified in RFC 4880, section 6.1 | [
"crc24",
"calculates",
"the",
"OpenPGP",
"checksum",
"as",
"specified",
"in",
"RFC",
"4880",
"section",
"6",
".",
"1"
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/armor/armor.go#L45-L56 |
149,963 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/private_key.go | Decrypt | func (pk *PrivateKey) Decrypt(passphrase []byte) error {
if !pk.Encrypted {
return nil
}
key := make([]byte, pk.cipher.KeySize())
pk.s2k(key, passphrase)
block := pk.cipher.new(key)
cfb := cipher.NewCFBDecrypter(block, pk.iv)
data := make([]byte, len(pk.encryptedData))
cfb.XORKeyStream(data, pk.encryptedDat... | go | func (pk *PrivateKey) Decrypt(passphrase []byte) error {
if !pk.Encrypted {
return nil
}
key := make([]byte, pk.cipher.KeySize())
pk.s2k(key, passphrase)
block := pk.cipher.new(key)
cfb := cipher.NewCFBDecrypter(block, pk.iv)
data := make([]byte, len(pk.encryptedData))
cfb.XORKeyStream(data, pk.encryptedDat... | [
"func",
"(",
"pk",
"*",
"PrivateKey",
")",
"Decrypt",
"(",
"passphrase",
"[",
"]",
"byte",
")",
"error",
"{",
"if",
"!",
"pk",
".",
"Encrypted",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"key",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"pk",
".",
... | // Decrypt decrypts an encrypted private key using a passphrase. | [
"Decrypt",
"decrypts",
"an",
"encrypted",
"private",
"key",
"using",
"a",
"passphrase",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/private_key.go#L189-L229 |
149,964 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/encrypted_key.go | Decrypt | func (e *EncryptedKey) Decrypt(priv *PrivateKey, config *Config) error {
var err error
var b []byte
// TODO(agl): use session key decryption routines here to avoid
// padding oracle attacks.
switch priv.PubKeyAlgo {
case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly:
b, err = rsa.DecryptPKCS1v15(config.Random(), pri... | go | func (e *EncryptedKey) Decrypt(priv *PrivateKey, config *Config) error {
var err error
var b []byte
// TODO(agl): use session key decryption routines here to avoid
// padding oracle attacks.
switch priv.PubKeyAlgo {
case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly:
b, err = rsa.DecryptPKCS1v15(config.Random(), pri... | [
"func",
"(",
"e",
"*",
"EncryptedKey",
")",
"Decrypt",
"(",
"priv",
"*",
"PrivateKey",
",",
"config",
"*",
"Config",
")",
"error",
"{",
"var",
"err",
"error",
"\n",
"var",
"b",
"[",
"]",
"byte",
"\n\n",
"// TODO(agl): use session key decryption routines here t... | // Decrypt decrypts an encrypted session key with the given private key. The
// private key must have been decrypted first.
// If config is nil, sensible defaults will be used. | [
"Decrypt",
"decrypts",
"an",
"encrypted",
"session",
"key",
"with",
"the",
"given",
"private",
"key",
".",
"The",
"private",
"key",
"must",
"have",
"been",
"decrypted",
"first",
".",
"If",
"config",
"is",
"nil",
"sensible",
"defaults",
"will",
"be",
"used",
... | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/encrypted_key.go#L67-L97 |
149,965 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/encrypted_key.go | Serialize | func (e *EncryptedKey) Serialize(w io.Writer) error {
var mpiLen int
switch e.Algo {
case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly:
mpiLen = 2 + len(e.encryptedMPI1.bytes)
case PubKeyAlgoElGamal:
mpiLen = 2 + len(e.encryptedMPI1.bytes) + 2 + len(e.encryptedMPI2.bytes)
default:
return errors.InvalidArgumentErr... | go | func (e *EncryptedKey) Serialize(w io.Writer) error {
var mpiLen int
switch e.Algo {
case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly:
mpiLen = 2 + len(e.encryptedMPI1.bytes)
case PubKeyAlgoElGamal:
mpiLen = 2 + len(e.encryptedMPI1.bytes) + 2 + len(e.encryptedMPI2.bytes)
default:
return errors.InvalidArgumentErr... | [
"func",
"(",
"e",
"*",
"EncryptedKey",
")",
"Serialize",
"(",
"w",
"io",
".",
"Writer",
")",
"error",
"{",
"var",
"mpiLen",
"int",
"\n",
"switch",
"e",
".",
"Algo",
"{",
"case",
"PubKeyAlgoRSA",
",",
"PubKeyAlgoRSAEncryptOnly",
":",
"mpiLen",
"=",
"2",
... | // Serialize writes the encrypted key packet, e, to w. | [
"Serialize",
"writes",
"the",
"encrypted",
"key",
"packet",
"e",
"to",
"w",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/encrypted_key.go#L100-L127 |
149,966 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/encrypted_key.go | SerializeEncryptedKey | func SerializeEncryptedKey(w io.Writer, pub *PublicKey, cipherFunc CipherFunction, key []byte, config *Config) error {
var buf [10]byte
buf[0] = encryptedKeyVersion
binary.BigEndian.PutUint64(buf[1:9], pub.KeyId)
buf[9] = byte(pub.PubKeyAlgo)
keyBlock := make([]byte, 1 /* cipher type */ +len(key)+2 /* checksum */... | go | func SerializeEncryptedKey(w io.Writer, pub *PublicKey, cipherFunc CipherFunction, key []byte, config *Config) error {
var buf [10]byte
buf[0] = encryptedKeyVersion
binary.BigEndian.PutUint64(buf[1:9], pub.KeyId)
buf[9] = byte(pub.PubKeyAlgo)
keyBlock := make([]byte, 1 /* cipher type */ +len(key)+2 /* checksum */... | [
"func",
"SerializeEncryptedKey",
"(",
"w",
"io",
".",
"Writer",
",",
"pub",
"*",
"PublicKey",
",",
"cipherFunc",
"CipherFunction",
",",
"key",
"[",
"]",
"byte",
",",
"config",
"*",
"Config",
")",
"error",
"{",
"var",
"buf",
"[",
"10",
"]",
"byte",
"\n"... | // SerializeEncryptedKey serializes an encrypted key packet to w that contains
// key, encrypted to pub.
// If config is nil, sensible defaults will be used. | [
"SerializeEncryptedKey",
"serializes",
"an",
"encrypted",
"key",
"packet",
"to",
"w",
"that",
"contains",
"key",
"encrypted",
"to",
"pub",
".",
"If",
"config",
"is",
"nil",
"sensible",
"defaults",
"will",
"be",
"used",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/encrypted_key.go#L132-L155 |
149,967 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/s2k/s2k.go | Parse | func Parse(r io.Reader) (f func(out, in []byte), err error) {
var buf [9]byte
_, err = io.ReadFull(r, buf[:2])
if err != nil {
return
}
hash, ok := HashIdToHash(buf[1])
if !ok {
return nil, errors.UnsupportedError("hash for S2K function: " + strconv.Itoa(int(buf[1])))
}
if !hash.Available() {
return nil... | go | func Parse(r io.Reader) (f func(out, in []byte), err error) {
var buf [9]byte
_, err = io.ReadFull(r, buf[:2])
if err != nil {
return
}
hash, ok := HashIdToHash(buf[1])
if !ok {
return nil, errors.UnsupportedError("hash for S2K function: " + strconv.Itoa(int(buf[1])))
}
if !hash.Available() {
return nil... | [
"func",
"Parse",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"f",
"func",
"(",
"out",
",",
"in",
"[",
"]",
"byte",
")",
",",
"err",
"error",
")",
"{",
"var",
"buf",
"[",
"9",
"]",
"byte",
"\n\n",
"_",
",",
"err",
"=",
"io",
".",
"ReadFull",
"(... | // Parse reads a binary specification for a string-to-key transformation from r
// and returns a function which performs that transform. | [
"Parse",
"reads",
"a",
"binary",
"specification",
"for",
"a",
"string",
"-",
"to",
"-",
"key",
"transformation",
"from",
"r",
"and",
"returns",
"a",
"function",
"which",
"performs",
"that",
"transform",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/s2k/s2k.go#L156-L201 |
149,968 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/s2k/s2k.go | Serialize | func Serialize(w io.Writer, key []byte, rand io.Reader, passphrase []byte, c *Config) error {
var buf [11]byte
buf[0] = 3 /* iterated and salted */
buf[1], _ = HashToHashId(c.hash())
salt := buf[2:10]
if _, err := io.ReadFull(rand, salt); err != nil {
return err
}
encodedCount := c.encodedCount()
count := dec... | go | func Serialize(w io.Writer, key []byte, rand io.Reader, passphrase []byte, c *Config) error {
var buf [11]byte
buf[0] = 3 /* iterated and salted */
buf[1], _ = HashToHashId(c.hash())
salt := buf[2:10]
if _, err := io.ReadFull(rand, salt); err != nil {
return err
}
encodedCount := c.encodedCount()
count := dec... | [
"func",
"Serialize",
"(",
"w",
"io",
".",
"Writer",
",",
"key",
"[",
"]",
"byte",
",",
"rand",
"io",
".",
"Reader",
",",
"passphrase",
"[",
"]",
"byte",
",",
"c",
"*",
"Config",
")",
"error",
"{",
"var",
"buf",
"[",
"11",
"]",
"byte",
"\n",
"bu... | // Serialize salts and stretches the given passphrase and writes the
// resulting key into key. It also serializes an S2K descriptor to
// w. The key stretching can be configured with c, which may be
// nil. In that case, sensible defaults will be used. | [
"Serialize",
"salts",
"and",
"stretches",
"the",
"given",
"passphrase",
"and",
"writes",
"the",
"resulting",
"key",
"into",
"key",
".",
"It",
"also",
"serializes",
"an",
"S2K",
"descriptor",
"to",
"w",
".",
"The",
"key",
"stretching",
"can",
"be",
"configure... | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/s2k/s2k.go#L207-L224 |
149,969 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/s2k/s2k.go | HashIdToHash | func HashIdToHash(id byte) (h crypto.Hash, ok bool) {
for _, m := range hashToHashIdMapping {
if m.id == id {
return m.hash, true
}
}
return 0, false
} | go | func HashIdToHash(id byte) (h crypto.Hash, ok bool) {
for _, m := range hashToHashIdMapping {
if m.id == id {
return m.hash, true
}
}
return 0, false
} | [
"func",
"HashIdToHash",
"(",
"id",
"byte",
")",
"(",
"h",
"crypto",
".",
"Hash",
",",
"ok",
"bool",
")",
"{",
"for",
"_",
",",
"m",
":=",
"range",
"hashToHashIdMapping",
"{",
"if",
"m",
".",
"id",
"==",
"id",
"{",
"return",
"m",
".",
"hash",
",",... | // HashIdToHash returns a crypto.Hash which corresponds to the given OpenPGP
// hash id. | [
"HashIdToHash",
"returns",
"a",
"crypto",
".",
"Hash",
"which",
"corresponds",
"to",
"the",
"given",
"OpenPGP",
"hash",
"id",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/s2k/s2k.go#L244-L251 |
149,970 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/s2k/s2k.go | HashIdToString | func HashIdToString(id byte) (name string, ok bool) {
for _, m := range hashToHashIdMapping {
if m.id == id {
return m.name, true
}
}
return "", false
} | go | func HashIdToString(id byte) (name string, ok bool) {
for _, m := range hashToHashIdMapping {
if m.id == id {
return m.name, true
}
}
return "", false
} | [
"func",
"HashIdToString",
"(",
"id",
"byte",
")",
"(",
"name",
"string",
",",
"ok",
"bool",
")",
"{",
"for",
"_",
",",
"m",
":=",
"range",
"hashToHashIdMapping",
"{",
"if",
"m",
".",
"id",
"==",
"id",
"{",
"return",
"m",
".",
"name",
",",
"true",
... | // HashIdToString returns the name of the hash function corresponding to the
// given OpenPGP hash id, or panics if id is unknown. | [
"HashIdToString",
"returns",
"the",
"name",
"of",
"the",
"hash",
"function",
"corresponding",
"to",
"the",
"given",
"OpenPGP",
"hash",
"id",
"or",
"panics",
"if",
"id",
"is",
"unknown",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/s2k/s2k.go#L255-L263 |
149,971 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/clearsign/clearsign.go | Decode | func Decode(data []byte) (b *Block, rest []byte) {
// start begins with a newline. However, at the very beginning of
// the byte array, we'll accept the start string without it.
rest = data
if bytes.HasPrefix(data, start[1:]) {
rest = rest[len(start)-1:]
} else if i := bytes.Index(data, start); i >= 0 {
rest =... | go | func Decode(data []byte) (b *Block, rest []byte) {
// start begins with a newline. However, at the very beginning of
// the byte array, we'll accept the start string without it.
rest = data
if bytes.HasPrefix(data, start[1:]) {
rest = rest[len(start)-1:]
} else if i := bytes.Index(data, start); i >= 0 {
rest =... | [
"func",
"Decode",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"b",
"*",
"Block",
",",
"rest",
"[",
"]",
"byte",
")",
"{",
"// start begins with a newline. However, at the very beginning of",
"// the byte array, we'll accept the start string without it.",
"rest",
"=",
"data... | // Decode finds the first clearsigned message in data and returns it, as well
// as the suffix of data which remains after the message. | [
"Decode",
"finds",
"the",
"first",
"clearsigned",
"message",
"in",
"data",
"and",
"returns",
"it",
"as",
"well",
"as",
"the",
"suffix",
"of",
"data",
"which",
"remains",
"after",
"the",
"message",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/clearsign/clearsign.go#L73-L166 |
149,972 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/clearsign/clearsign.go | Encode | func Encode(w io.Writer, privateKey *packet.PrivateKey, config *packet.Config) (plaintext io.WriteCloser, err error) {
if privateKey.Encrypted {
return nil, errors.InvalidArgumentError("signing key is encrypted")
}
hashType := config.Hash()
name := nameOfHash(hashType)
if len(name) == 0 {
return nil, errors.U... | go | func Encode(w io.Writer, privateKey *packet.PrivateKey, config *packet.Config) (plaintext io.WriteCloser, err error) {
if privateKey.Encrypted {
return nil, errors.InvalidArgumentError("signing key is encrypted")
}
hashType := config.Hash()
name := nameOfHash(hashType)
if len(name) == 0 {
return nil, errors.U... | [
"func",
"Encode",
"(",
"w",
"io",
".",
"Writer",
",",
"privateKey",
"*",
"packet",
".",
"PrivateKey",
",",
"config",
"*",
"packet",
".",
"Config",
")",
"(",
"plaintext",
"io",
".",
"WriteCloser",
",",
"err",
"error",
")",
"{",
"if",
"privateKey",
".",
... | // Encode returns a WriteCloser which will clear-sign a message with privateKey
// and write it to w. If config is nil, sensible defaults are used. | [
"Encode",
"returns",
"a",
"WriteCloser",
"which",
"will",
"clear",
"-",
"sign",
"a",
"message",
"with",
"privateKey",
"and",
"write",
"it",
"to",
"w",
".",
"If",
"config",
"is",
"nil",
"sensible",
"defaults",
"are",
"used",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/clearsign/clearsign.go#L292-L344 |
149,973 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/clearsign/clearsign.go | nameOfHash | func nameOfHash(h crypto.Hash) string {
switch h {
case crypto.MD5:
return "MD5"
case crypto.SHA1:
return "SHA1"
case crypto.RIPEMD160:
return "RIPEMD160"
case crypto.SHA224:
return "SHA224"
case crypto.SHA256:
return "SHA256"
case crypto.SHA384:
return "SHA384"
case crypto.SHA512:
return "SHA512"... | go | func nameOfHash(h crypto.Hash) string {
switch h {
case crypto.MD5:
return "MD5"
case crypto.SHA1:
return "SHA1"
case crypto.RIPEMD160:
return "RIPEMD160"
case crypto.SHA224:
return "SHA224"
case crypto.SHA256:
return "SHA256"
case crypto.SHA384:
return "SHA384"
case crypto.SHA512:
return "SHA512"... | [
"func",
"nameOfHash",
"(",
"h",
"crypto",
".",
"Hash",
")",
"string",
"{",
"switch",
"h",
"{",
"case",
"crypto",
".",
"MD5",
":",
"return",
"\"",
"\"",
"\n",
"case",
"crypto",
".",
"SHA1",
":",
"return",
"\"",
"\"",
"\n",
"case",
"crypto",
".",
"RI... | // nameOfHash returns the OpenPGP name for the given hash, or the empty string
// if the name isn't known. See RFC 4880, section 9.4. | [
"nameOfHash",
"returns",
"the",
"OpenPGP",
"name",
"for",
"the",
"given",
"hash",
"or",
"the",
"empty",
"string",
"if",
"the",
"name",
"isn",
"t",
"known",
".",
"See",
"RFC",
"4880",
"section",
"9",
".",
"4",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/clearsign/clearsign.go#L348-L366 |
149,974 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/cast5/cast5.go | f1 | func f1(d, m uint32, r uint8) uint32 {
t := m + d
I := (t << r) | (t >> (32 - r))
return ((sBox[0][I>>24] ^ sBox[1][(I>>16)&0xff]) - sBox[2][(I>>8)&0xff]) + sBox[3][I&0xff]
} | go | func f1(d, m uint32, r uint8) uint32 {
t := m + d
I := (t << r) | (t >> (32 - r))
return ((sBox[0][I>>24] ^ sBox[1][(I>>16)&0xff]) - sBox[2][(I>>8)&0xff]) + sBox[3][I&0xff]
} | [
"func",
"f1",
"(",
"d",
",",
"m",
"uint32",
",",
"r",
"uint8",
")",
"uint32",
"{",
"t",
":=",
"m",
"+",
"d",
"\n",
"I",
":=",
"(",
"t",
"<<",
"r",
")",
"|",
"(",
"t",
">>",
"(",
"32",
"-",
"r",
")",
")",
"\n",
"return",
"(",
"(",
"sBox"... | // These are the three 'f' functions. See RFC 2144, section 2.2. | [
"These",
"are",
"the",
"three",
"f",
"functions",
".",
"See",
"RFC",
"2144",
"section",
"2",
".",
"2",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/cast5/cast5.go#L235-L239 |
149,975 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key.go | parseOID | func parseOID(r io.Reader) (oid []byte, err error) {
buf := make([]byte, maxOIDLength)
if _, err = readFull(r, buf[:1]); err != nil {
return
}
oidLen := buf[0]
if int(oidLen) > len(buf) {
err = errors.UnsupportedError("invalid oid length: " + strconv.Itoa(int(oidLen)))
return
}
oid = buf[:oidLen]
_, err =... | go | func parseOID(r io.Reader) (oid []byte, err error) {
buf := make([]byte, maxOIDLength)
if _, err = readFull(r, buf[:1]); err != nil {
return
}
oidLen := buf[0]
if int(oidLen) > len(buf) {
err = errors.UnsupportedError("invalid oid length: " + strconv.Itoa(int(oidLen)))
return
}
oid = buf[:oidLen]
_, err =... | [
"func",
"parseOID",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"oid",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"buf",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"maxOIDLength",
")",
"\n",
"if",
"_",
",",
"err",
"=",
"readFull",
"(",
"r",
... | // parseOID reads the OID for the curve as defined in RFC 6637, Section 9. | [
"parseOID",
"reads",
"the",
"OID",
"for",
"the",
"curve",
"as",
"defined",
"in",
"RFC",
"6637",
"Section",
"9",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key.go#L50-L63 |
149,976 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key.go | NewRSAPublicKey | func NewRSAPublicKey(creationTime time.Time, pub *rsa.PublicKey) *PublicKey {
pk := &PublicKey{
CreationTime: creationTime,
PubKeyAlgo: PubKeyAlgoRSA,
PublicKey: pub,
n: fromBig(pub.N),
e: fromBig(big.NewInt(int64(pub.E))),
}
pk.setFingerPrintAndKeyId()
return pk
} | go | func NewRSAPublicKey(creationTime time.Time, pub *rsa.PublicKey) *PublicKey {
pk := &PublicKey{
CreationTime: creationTime,
PubKeyAlgo: PubKeyAlgoRSA,
PublicKey: pub,
n: fromBig(pub.N),
e: fromBig(big.NewInt(int64(pub.E))),
}
pk.setFingerPrintAndKeyId()
return pk
} | [
"func",
"NewRSAPublicKey",
"(",
"creationTime",
"time",
".",
"Time",
",",
"pub",
"*",
"rsa",
".",
"PublicKey",
")",
"*",
"PublicKey",
"{",
"pk",
":=",
"&",
"PublicKey",
"{",
"CreationTime",
":",
"creationTime",
",",
"PubKeyAlgo",
":",
"PubKeyAlgoRSA",
",",
... | // NewRSAPublicKey returns a PublicKey that wraps the given rsa.PublicKey. | [
"NewRSAPublicKey",
"returns",
"a",
"PublicKey",
"that",
"wraps",
"the",
"given",
"rsa",
".",
"PublicKey",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key.go#L183-L194 |
149,977 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key.go | NewDSAPublicKey | func NewDSAPublicKey(creationTime time.Time, pub *dsa.PublicKey) *PublicKey {
pk := &PublicKey{
CreationTime: creationTime,
PubKeyAlgo: PubKeyAlgoDSA,
PublicKey: pub,
p: fromBig(pub.P),
q: fromBig(pub.Q),
g: fromBig(pub.G),
y: fromBig(pub.Y),
}
pk.setFi... | go | func NewDSAPublicKey(creationTime time.Time, pub *dsa.PublicKey) *PublicKey {
pk := &PublicKey{
CreationTime: creationTime,
PubKeyAlgo: PubKeyAlgoDSA,
PublicKey: pub,
p: fromBig(pub.P),
q: fromBig(pub.Q),
g: fromBig(pub.G),
y: fromBig(pub.Y),
}
pk.setFi... | [
"func",
"NewDSAPublicKey",
"(",
"creationTime",
"time",
".",
"Time",
",",
"pub",
"*",
"dsa",
".",
"PublicKey",
")",
"*",
"PublicKey",
"{",
"pk",
":=",
"&",
"PublicKey",
"{",
"CreationTime",
":",
"creationTime",
",",
"PubKeyAlgo",
":",
"PubKeyAlgoDSA",
",",
... | // NewDSAPublicKey returns a PublicKey that wraps the given rsa.PublicKey. | [
"NewDSAPublicKey",
"returns",
"a",
"PublicKey",
"that",
"wraps",
"the",
"given",
"rsa",
".",
"PublicKey",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key.go#L197-L210 |
149,978 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key.go | parseDSA | func (pk *PublicKey) parseDSA(r io.Reader) (err error) {
pk.p.bytes, pk.p.bitLength, err = readMPI(r)
if err != nil {
return
}
pk.q.bytes, pk.q.bitLength, err = readMPI(r)
if err != nil {
return
}
pk.g.bytes, pk.g.bitLength, err = readMPI(r)
if err != nil {
return
}
pk.y.bytes, pk.y.bitLength, err = rea... | go | func (pk *PublicKey) parseDSA(r io.Reader) (err error) {
pk.p.bytes, pk.p.bitLength, err = readMPI(r)
if err != nil {
return
}
pk.q.bytes, pk.q.bitLength, err = readMPI(r)
if err != nil {
return
}
pk.g.bytes, pk.g.bitLength, err = readMPI(r)
if err != nil {
return
}
pk.y.bytes, pk.y.bitLength, err = rea... | [
"func",
"(",
"pk",
"*",
"PublicKey",
")",
"parseDSA",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"err",
"error",
")",
"{",
"pk",
".",
"p",
".",
"bytes",
",",
"pk",
".",
"p",
".",
"bitLength",
",",
"err",
"=",
"readMPI",
"(",
"r",
")",
"\n",
"if... | // parseDSA parses DSA public key material from the given Reader. See RFC 4880,
// section 5.5.2. | [
"parseDSA",
"parses",
"DSA",
"public",
"key",
"material",
"from",
"the",
"given",
"Reader",
".",
"See",
"RFC",
"4880",
"section",
"5",
".",
"5",
".",
"2",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key.go#L298-L323 |
149,979 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key.go | parseElGamal | func (pk *PublicKey) parseElGamal(r io.Reader) (err error) {
pk.p.bytes, pk.p.bitLength, err = readMPI(r)
if err != nil {
return
}
pk.g.bytes, pk.g.bitLength, err = readMPI(r)
if err != nil {
return
}
pk.y.bytes, pk.y.bitLength, err = readMPI(r)
if err != nil {
return
}
elgamal := new(elgamal.PublicKey... | go | func (pk *PublicKey) parseElGamal(r io.Reader) (err error) {
pk.p.bytes, pk.p.bitLength, err = readMPI(r)
if err != nil {
return
}
pk.g.bytes, pk.g.bitLength, err = readMPI(r)
if err != nil {
return
}
pk.y.bytes, pk.y.bitLength, err = readMPI(r)
if err != nil {
return
}
elgamal := new(elgamal.PublicKey... | [
"func",
"(",
"pk",
"*",
"PublicKey",
")",
"parseElGamal",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"err",
"error",
")",
"{",
"pk",
".",
"p",
".",
"bytes",
",",
"pk",
".",
"p",
".",
"bitLength",
",",
"err",
"=",
"readMPI",
"(",
"r",
")",
"\n",
... | // parseElGamal parses ElGamal public key material from the given Reader. See
// RFC 4880, section 5.5.2. | [
"parseElGamal",
"parses",
"ElGamal",
"public",
"key",
"material",
"from",
"the",
"given",
"Reader",
".",
"See",
"RFC",
"4880",
"section",
"5",
".",
"5",
".",
"2",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key.go#L327-L347 |
149,980 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key.go | CanSign | func (pk *PublicKey) CanSign() bool {
return pk.PubKeyAlgo != PubKeyAlgoRSAEncryptOnly && pk.PubKeyAlgo != PubKeyAlgoElGamal
} | go | func (pk *PublicKey) CanSign() bool {
return pk.PubKeyAlgo != PubKeyAlgoRSAEncryptOnly && pk.PubKeyAlgo != PubKeyAlgoElGamal
} | [
"func",
"(",
"pk",
"*",
"PublicKey",
")",
"CanSign",
"(",
")",
"bool",
"{",
"return",
"pk",
".",
"PubKeyAlgo",
"!=",
"PubKeyAlgoRSAEncryptOnly",
"&&",
"pk",
".",
"PubKeyAlgo",
"!=",
"PubKeyAlgoElGamal",
"\n",
"}"
] | // CanSign returns true iff this public key can generate signatures | [
"CanSign",
"returns",
"true",
"iff",
"this",
"public",
"key",
"can",
"generate",
"signatures"
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key.go#L452-L454 |
149,981 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key.go | VerifySignature | func (pk *PublicKey) VerifySignature(signed hash.Hash, sig *Signature) (err error) {
if !pk.CanSign() {
return errors.InvalidArgumentError("public key cannot generate signatures")
}
signed.Write(sig.HashSuffix)
hashBytes := signed.Sum(nil)
if hashBytes[0] != sig.HashTag[0] || hashBytes[1] != sig.HashTag[1] {
... | go | func (pk *PublicKey) VerifySignature(signed hash.Hash, sig *Signature) (err error) {
if !pk.CanSign() {
return errors.InvalidArgumentError("public key cannot generate signatures")
}
signed.Write(sig.HashSuffix)
hashBytes := signed.Sum(nil)
if hashBytes[0] != sig.HashTag[0] || hashBytes[1] != sig.HashTag[1] {
... | [
"func",
"(",
"pk",
"*",
"PublicKey",
")",
"VerifySignature",
"(",
"signed",
"hash",
".",
"Hash",
",",
"sig",
"*",
"Signature",
")",
"(",
"err",
"error",
")",
"{",
"if",
"!",
"pk",
".",
"CanSign",
"(",
")",
"{",
"return",
"errors",
".",
"InvalidArgume... | // VerifySignature returns nil iff sig is a valid signature, made by this
// public key, of the data hashed into signed. signed is mutated by this call. | [
"VerifySignature",
"returns",
"nil",
"iff",
"sig",
"is",
"a",
"valid",
"signature",
"made",
"by",
"this",
"public",
"key",
"of",
"the",
"data",
"hashed",
"into",
"signed",
".",
"signed",
"is",
"mutated",
"by",
"this",
"call",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key.go#L458-L503 |
149,982 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key.go | VerifyKeySignature | func (pk *PublicKey) VerifyKeySignature(signed *PublicKey, sig *Signature) error {
h, err := keySignatureHash(pk, signed, sig.Hash)
if err != nil {
return err
}
if err = pk.VerifySignature(h, sig); err != nil {
return err
}
if sig.FlagSign {
// Signing subkeys must be cross-signed. See
// https://www.gnu... | go | func (pk *PublicKey) VerifyKeySignature(signed *PublicKey, sig *Signature) error {
h, err := keySignatureHash(pk, signed, sig.Hash)
if err != nil {
return err
}
if err = pk.VerifySignature(h, sig); err != nil {
return err
}
if sig.FlagSign {
// Signing subkeys must be cross-signed. See
// https://www.gnu... | [
"func",
"(",
"pk",
"*",
"PublicKey",
")",
"VerifyKeySignature",
"(",
"signed",
"*",
"PublicKey",
",",
"sig",
"*",
"Signature",
")",
"error",
"{",
"h",
",",
"err",
":=",
"keySignatureHash",
"(",
"pk",
",",
"signed",
",",
"sig",
".",
"Hash",
")",
"\n",
... | // VerifyKeySignature returns nil iff sig is a valid signature, made by this
// public key, of signed. | [
"VerifyKeySignature",
"returns",
"nil",
"iff",
"sig",
"is",
"a",
"valid",
"signature",
"made",
"by",
"this",
"public",
"key",
"of",
"signed",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key.go#L568-L595 |
149,983 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key.go | VerifyRevocationSignature | func (pk *PublicKey) VerifyRevocationSignature(sig *Signature) (err error) {
h, err := keyRevocationHash(pk, sig.Hash)
if err != nil {
return err
}
return pk.VerifySignature(h, sig)
} | go | func (pk *PublicKey) VerifyRevocationSignature(sig *Signature) (err error) {
h, err := keyRevocationHash(pk, sig.Hash)
if err != nil {
return err
}
return pk.VerifySignature(h, sig)
} | [
"func",
"(",
"pk",
"*",
"PublicKey",
")",
"VerifyRevocationSignature",
"(",
"sig",
"*",
"Signature",
")",
"(",
"err",
"error",
")",
"{",
"h",
",",
"err",
":=",
"keyRevocationHash",
"(",
"pk",
",",
"sig",
".",
"Hash",
")",
"\n",
"if",
"err",
"!=",
"ni... | // VerifyRevocationSignature returns nil iff sig is a valid signature, made by this
// public key. | [
"VerifyRevocationSignature",
"returns",
"nil",
"iff",
"sig",
"is",
"a",
"valid",
"signature",
"made",
"by",
"this",
"public",
"key",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key.go#L612-L618 |
149,984 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key.go | userIdSignatureHash | func userIdSignatureHash(id string, pk *PublicKey, hashFunc crypto.Hash) (h hash.Hash, err error) {
if !hashFunc.Available() {
return nil, errors.UnsupportedError("hash function")
}
h = hashFunc.New()
// RFC 4880, section 5.2.4
pk.SerializeSignaturePrefix(h)
pk.serializeWithoutHeaders(h)
var buf [5]byte
buf... | go | func userIdSignatureHash(id string, pk *PublicKey, hashFunc crypto.Hash) (h hash.Hash, err error) {
if !hashFunc.Available() {
return nil, errors.UnsupportedError("hash function")
}
h = hashFunc.New()
// RFC 4880, section 5.2.4
pk.SerializeSignaturePrefix(h)
pk.serializeWithoutHeaders(h)
var buf [5]byte
buf... | [
"func",
"userIdSignatureHash",
"(",
"id",
"string",
",",
"pk",
"*",
"PublicKey",
",",
"hashFunc",
"crypto",
".",
"Hash",
")",
"(",
"h",
"hash",
".",
"Hash",
",",
"err",
"error",
")",
"{",
"if",
"!",
"hashFunc",
".",
"Available",
"(",
")",
"{",
"retur... | // userIdSignatureHash returns a Hash of the message that needs to be signed
// to assert that pk is a valid key for id. | [
"userIdSignatureHash",
"returns",
"a",
"Hash",
"of",
"the",
"message",
"that",
"needs",
"to",
"be",
"signed",
"to",
"assert",
"that",
"pk",
"is",
"a",
"valid",
"key",
"for",
"id",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key.go#L622-L642 |
149,985 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key.go | VerifyUserIdSignature | func (pk *PublicKey) VerifyUserIdSignature(id string, pub *PublicKey, sig *Signature) (err error) {
h, err := userIdSignatureHash(id, pub, sig.Hash)
if err != nil {
return err
}
return pk.VerifySignature(h, sig)
} | go | func (pk *PublicKey) VerifyUserIdSignature(id string, pub *PublicKey, sig *Signature) (err error) {
h, err := userIdSignatureHash(id, pub, sig.Hash)
if err != nil {
return err
}
return pk.VerifySignature(h, sig)
} | [
"func",
"(",
"pk",
"*",
"PublicKey",
")",
"VerifyUserIdSignature",
"(",
"id",
"string",
",",
"pub",
"*",
"PublicKey",
",",
"sig",
"*",
"Signature",
")",
"(",
"err",
"error",
")",
"{",
"h",
",",
"err",
":=",
"userIdSignatureHash",
"(",
"id",
",",
"pub",... | // VerifyUserIdSignature returns nil iff sig is a valid signature, made by this
// public key, that id is the identity of pub. | [
"VerifyUserIdSignature",
"returns",
"nil",
"iff",
"sig",
"is",
"a",
"valid",
"signature",
"made",
"by",
"this",
"public",
"key",
"that",
"id",
"is",
"the",
"identity",
"of",
"pub",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key.go#L646-L652 |
149,986 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key.go | VerifyUserIdSignatureV3 | func (pk *PublicKey) VerifyUserIdSignatureV3(id string, pub *PublicKey, sig *SignatureV3) (err error) {
h, err := userIdSignatureV3Hash(id, pub, sig.Hash)
if err != nil {
return err
}
return pk.VerifySignatureV3(h, sig)
} | go | func (pk *PublicKey) VerifyUserIdSignatureV3(id string, pub *PublicKey, sig *SignatureV3) (err error) {
h, err := userIdSignatureV3Hash(id, pub, sig.Hash)
if err != nil {
return err
}
return pk.VerifySignatureV3(h, sig)
} | [
"func",
"(",
"pk",
"*",
"PublicKey",
")",
"VerifyUserIdSignatureV3",
"(",
"id",
"string",
",",
"pub",
"*",
"PublicKey",
",",
"sig",
"*",
"SignatureV3",
")",
"(",
"err",
"error",
")",
"{",
"h",
",",
"err",
":=",
"userIdSignatureV3Hash",
"(",
"id",
",",
... | // VerifyUserIdSignatureV3 returns nil iff sig is a valid signature, made by this
// public key, that id is the identity of pub. | [
"VerifyUserIdSignatureV3",
"returns",
"nil",
"iff",
"sig",
"is",
"a",
"valid",
"signature",
"made",
"by",
"this",
"public",
"key",
"that",
"id",
"is",
"the",
"identity",
"of",
"pub",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key.go#L656-L662 |
149,987 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key.go | writeMPIs | func writeMPIs(w io.Writer, mpis ...parsedMPI) (err error) {
for _, mpi := range mpis {
err = writeMPI(w, mpi.bitLength, mpi.bytes)
if err != nil {
return
}
}
return
} | go | func writeMPIs(w io.Writer, mpis ...parsedMPI) (err error) {
for _, mpi := range mpis {
err = writeMPI(w, mpi.bitLength, mpi.bytes)
if err != nil {
return
}
}
return
} | [
"func",
"writeMPIs",
"(",
"w",
"io",
".",
"Writer",
",",
"mpis",
"...",
"parsedMPI",
")",
"(",
"err",
"error",
")",
"{",
"for",
"_",
",",
"mpi",
":=",
"range",
"mpis",
"{",
"err",
"=",
"writeMPI",
"(",
"w",
",",
"mpi",
".",
"bitLength",
",",
"mpi... | // writeMPIs is a utility function for serializing several big integers to the
// given Writer. | [
"writeMPIs",
"is",
"a",
"utility",
"function",
"for",
"serializing",
"several",
"big",
"integers",
"to",
"the",
"given",
"Writer",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key.go#L686-L694 |
149,988 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/userattribute.go | NewUserAttributePhoto | func NewUserAttributePhoto(photos ...image.Image) (uat *UserAttribute, err error) {
uat = new(UserAttribute)
for _, photo := range photos {
var buf bytes.Buffer
// RFC 4880, Section 5.12.1.
data := []byte{
0x10, 0x00, // Little-endian image header length (16 bytes)
0x01, // Image header version 1
... | go | func NewUserAttributePhoto(photos ...image.Image) (uat *UserAttribute, err error) {
uat = new(UserAttribute)
for _, photo := range photos {
var buf bytes.Buffer
// RFC 4880, Section 5.12.1.
data := []byte{
0x10, 0x00, // Little-endian image header length (16 bytes)
0x01, // Image header version 1
... | [
"func",
"NewUserAttributePhoto",
"(",
"photos",
"...",
"image",
".",
"Image",
")",
"(",
"uat",
"*",
"UserAttribute",
",",
"err",
"error",
")",
"{",
"uat",
"=",
"new",
"(",
"UserAttribute",
")",
"\n",
"for",
"_",
",",
"photo",
":=",
"range",
"photos",
"... | // NewUserAttributePhoto creates a user attribute packet
// containing the given images. | [
"NewUserAttributePhoto",
"creates",
"a",
"user",
"attribute",
"packet",
"containing",
"the",
"given",
"images",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/userattribute.go#L27-L50 |
149,989 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/userattribute.go | Serialize | func (uat *UserAttribute) Serialize(w io.Writer) (err error) {
var buf bytes.Buffer
for _, sp := range uat.Contents {
sp.Serialize(&buf)
}
if err = serializeHeader(w, packetTypeUserAttribute, buf.Len()); err != nil {
return err
}
_, err = w.Write(buf.Bytes())
return
} | go | func (uat *UserAttribute) Serialize(w io.Writer) (err error) {
var buf bytes.Buffer
for _, sp := range uat.Contents {
sp.Serialize(&buf)
}
if err = serializeHeader(w, packetTypeUserAttribute, buf.Len()); err != nil {
return err
}
_, err = w.Write(buf.Bytes())
return
} | [
"func",
"(",
"uat",
"*",
"UserAttribute",
")",
"Serialize",
"(",
"w",
"io",
".",
"Writer",
")",
"(",
"err",
"error",
")",
"{",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"for",
"_",
",",
"sp",
":=",
"range",
"uat",
".",
"Contents",
"{",
"sp",
".... | // Serialize marshals the user attribute to w in the form of an OpenPGP packet, including
// header. | [
"Serialize",
"marshals",
"the",
"user",
"attribute",
"to",
"w",
"in",
"the",
"form",
"of",
"an",
"OpenPGP",
"packet",
"including",
"header",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/userattribute.go#L69-L79 |
149,990 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/userid.go | Serialize | func (uid *UserId) Serialize(w io.Writer) error {
err := serializeHeader(w, packetTypeUserId, len(uid.Id))
if err != nil {
return err
}
_, err = w.Write([]byte(uid.Id))
return err
} | go | func (uid *UserId) Serialize(w io.Writer) error {
err := serializeHeader(w, packetTypeUserId, len(uid.Id))
if err != nil {
return err
}
_, err = w.Write([]byte(uid.Id))
return err
} | [
"func",
"(",
"uid",
"*",
"UserId",
")",
"Serialize",
"(",
"w",
"io",
".",
"Writer",
")",
"error",
"{",
"err",
":=",
"serializeHeader",
"(",
"w",
",",
"packetTypeUserId",
",",
"len",
"(",
"uid",
".",
"Id",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
... | // Serialize marshals uid to w in the form of an OpenPGP packet, including
// header. | [
"Serialize",
"marshals",
"uid",
"to",
"w",
"in",
"the",
"form",
"of",
"an",
"OpenPGP",
"packet",
"including",
"header",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/userid.go#L80-L87 |
149,991 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/symmetric_key_encrypted.go | Decrypt | func (ske *SymmetricKeyEncrypted) Decrypt(passphrase []byte) error {
if !ske.Encrypted {
return nil
}
key := make([]byte, ske.CipherFunc.KeySize())
ske.s2k(key, passphrase)
if len(ske.encryptedKey) == 0 {
ske.Key = key
} else {
// the IV is all zeros
iv := make([]byte, ske.CipherFunc.blockSize())
c :=... | go | func (ske *SymmetricKeyEncrypted) Decrypt(passphrase []byte) error {
if !ske.Encrypted {
return nil
}
key := make([]byte, ske.CipherFunc.KeySize())
ske.s2k(key, passphrase)
if len(ske.encryptedKey) == 0 {
ske.Key = key
} else {
// the IV is all zeros
iv := make([]byte, ske.CipherFunc.blockSize())
c :=... | [
"func",
"(",
"ske",
"*",
"SymmetricKeyEncrypted",
")",
"Decrypt",
"(",
"passphrase",
"[",
"]",
"byte",
")",
"error",
"{",
"if",
"!",
"ske",
".",
"Encrypted",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"key",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
... | // Decrypt attempts to decrypt an encrypted session key. If it returns nil,
// ske.Key will contain the session key. | [
"Decrypt",
"attempts",
"to",
"decrypt",
"an",
"encrypted",
"session",
"key",
".",
"If",
"it",
"returns",
"nil",
"ske",
".",
"Key",
"will",
"contain",
"the",
"session",
"key",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/symmetric_key_encrypted.go#L76-L105 |
149,992 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/symmetric_key_encrypted.go | SerializeSymmetricKeyEncrypted | func SerializeSymmetricKeyEncrypted(w io.Writer, passphrase []byte, config *Config) (key []byte, err error) {
cipherFunc := config.Cipher()
keySize := cipherFunc.KeySize()
if keySize == 0 {
return nil, errors.UnsupportedError("unknown cipher: " + strconv.Itoa(int(cipherFunc)))
}
s2kBuf := new(bytes.Buffer)
key... | go | func SerializeSymmetricKeyEncrypted(w io.Writer, passphrase []byte, config *Config) (key []byte, err error) {
cipherFunc := config.Cipher()
keySize := cipherFunc.KeySize()
if keySize == 0 {
return nil, errors.UnsupportedError("unknown cipher: " + strconv.Itoa(int(cipherFunc)))
}
s2kBuf := new(bytes.Buffer)
key... | [
"func",
"SerializeSymmetricKeyEncrypted",
"(",
"w",
"io",
".",
"Writer",
",",
"passphrase",
"[",
"]",
"byte",
",",
"config",
"*",
"Config",
")",
"(",
"key",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"cipherFunc",
":=",
"config",
".",
"Cipher",
"... | // SerializeSymmetricKeyEncrypted serializes a symmetric key packet to w. The
// packet contains a random session key, encrypted by a key derived from the
// given passphrase. The session key is returned and must be passed to
// SerializeSymmetricallyEncrypted.
// If config is nil, sensible defaults will be used. | [
"SerializeSymmetricKeyEncrypted",
"serializes",
"a",
"symmetric",
"key",
"packet",
"to",
"w",
".",
"The",
"packet",
"contains",
"a",
"random",
"session",
"key",
"encrypted",
"by",
"a",
"key",
"derived",
"from",
"the",
"given",
"passphrase",
".",
"The",
"session"... | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/symmetric_key_encrypted.go#L112-L164 |
149,993 | lavab/mailer | Godeps/_workspace/src/code.google.com/p/go.crypto/scrypt/scrypt.go | blockCopy | func blockCopy(dst, src []uint32, n int) {
copy(dst, src[:n])
} | go | func blockCopy(dst, src []uint32, n int) {
copy(dst, src[:n])
} | [
"func",
"blockCopy",
"(",
"dst",
",",
"src",
"[",
"]",
"uint32",
",",
"n",
"int",
")",
"{",
"copy",
"(",
"dst",
",",
"src",
"[",
":",
"n",
"]",
")",
"\n",
"}"
] | // blockCopy copies n numbers from src into dst. | [
"blockCopy",
"copies",
"n",
"numbers",
"from",
"src",
"into",
"dst",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/code.google.com/p/go.crypto/scrypt/scrypt.go#L20-L22 |
149,994 | lavab/mailer | Godeps/_workspace/src/code.google.com/p/go.crypto/scrypt/scrypt.go | blockXOR | func blockXOR(dst, src []uint32, n int) {
for i, v := range src[:n] {
dst[i] ^= v
}
} | go | func blockXOR(dst, src []uint32, n int) {
for i, v := range src[:n] {
dst[i] ^= v
}
} | [
"func",
"blockXOR",
"(",
"dst",
",",
"src",
"[",
"]",
"uint32",
",",
"n",
"int",
")",
"{",
"for",
"i",
",",
"v",
":=",
"range",
"src",
"[",
":",
"n",
"]",
"{",
"dst",
"[",
"i",
"]",
"^=",
"v",
"\n",
"}",
"\n",
"}"
] | // blockXOR XORs numbers from dst with n numbers from src. | [
"blockXOR",
"XORs",
"numbers",
"from",
"dst",
"with",
"n",
"numbers",
"from",
"src",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/code.google.com/p/go.crypto/scrypt/scrypt.go#L25-L29 |
149,995 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key_v3.go | parseRSA | func (pk *PublicKeyV3) parseRSA(r io.Reader) (err error) {
if pk.n.bytes, pk.n.bitLength, err = readMPI(r); err != nil {
return
}
if pk.e.bytes, pk.e.bitLength, err = readMPI(r); err != nil {
return
}
if len(pk.e.bytes) > 3 {
err = errors.UnsupportedError("large public exponent")
return
}
rsa := &rsa.Pu... | go | func (pk *PublicKeyV3) parseRSA(r io.Reader) (err error) {
if pk.n.bytes, pk.n.bitLength, err = readMPI(r); err != nil {
return
}
if pk.e.bytes, pk.e.bitLength, err = readMPI(r); err != nil {
return
}
if len(pk.e.bytes) > 3 {
err = errors.UnsupportedError("large public exponent")
return
}
rsa := &rsa.Pu... | [
"func",
"(",
"pk",
"*",
"PublicKeyV3",
")",
"parseRSA",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"err",
"error",
")",
"{",
"if",
"pk",
".",
"n",
".",
"bytes",
",",
"pk",
".",
"n",
".",
"bitLength",
",",
"err",
"=",
"readMPI",
"(",
"r",
")",
"... | // parseRSA parses RSA public key material from the given Reader. See RFC 4880,
// section 5.5.2. | [
"parseRSA",
"parses",
"RSA",
"public",
"key",
"material",
"from",
"the",
"given",
"Reader",
".",
"See",
"RFC",
"4880",
"section",
"5",
".",
"5",
".",
"2",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key_v3.go#L90-L109 |
149,996 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key_v3.go | VerifyKeySignatureV3 | func (pk *PublicKeyV3) VerifyKeySignatureV3(signed *PublicKeyV3, sig *SignatureV3) (err error) {
h, err := keySignatureHash(pk, signed, sig.Hash)
if err != nil {
return err
}
return pk.VerifySignatureV3(h, sig)
} | go | func (pk *PublicKeyV3) VerifyKeySignatureV3(signed *PublicKeyV3, sig *SignatureV3) (err error) {
h, err := keySignatureHash(pk, signed, sig.Hash)
if err != nil {
return err
}
return pk.VerifySignatureV3(h, sig)
} | [
"func",
"(",
"pk",
"*",
"PublicKeyV3",
")",
"VerifyKeySignatureV3",
"(",
"signed",
"*",
"PublicKeyV3",
",",
"sig",
"*",
"SignatureV3",
")",
"(",
"err",
"error",
")",
"{",
"h",
",",
"err",
":=",
"keySignatureHash",
"(",
"pk",
",",
"signed",
",",
"sig",
... | // VerifyKeySignatureV3 returns nil iff sig is a valid signature, made by this
// public key, of signed. | [
"VerifyKeySignatureV3",
"returns",
"nil",
"iff",
"sig",
"is",
"a",
"valid",
"signature",
"made",
"by",
"this",
"public",
"key",
"of",
"signed",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key_v3.go#L229-L235 |
149,997 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key_v3.go | userIdSignatureV3Hash | func userIdSignatureV3Hash(id string, pk signingKey, hfn crypto.Hash) (h hash.Hash, err error) {
if !hfn.Available() {
return nil, errors.UnsupportedError("hash function")
}
h = hfn.New()
// RFC 4880, section 5.2.4
pk.SerializeSignaturePrefix(h)
pk.serializeWithoutHeaders(h)
h.Write([]byte(id))
return
} | go | func userIdSignatureV3Hash(id string, pk signingKey, hfn crypto.Hash) (h hash.Hash, err error) {
if !hfn.Available() {
return nil, errors.UnsupportedError("hash function")
}
h = hfn.New()
// RFC 4880, section 5.2.4
pk.SerializeSignaturePrefix(h)
pk.serializeWithoutHeaders(h)
h.Write([]byte(id))
return
} | [
"func",
"userIdSignatureV3Hash",
"(",
"id",
"string",
",",
"pk",
"signingKey",
",",
"hfn",
"crypto",
".",
"Hash",
")",
"(",
"h",
"hash",
".",
"Hash",
",",
"err",
"error",
")",
"{",
"if",
"!",
"hfn",
".",
"Available",
"(",
")",
"{",
"return",
"nil",
... | // userIdSignatureV3Hash returns a Hash of the message that needs to be signed
// to assert that pk is a valid key for id. | [
"userIdSignatureV3Hash",
"returns",
"a",
"Hash",
"of",
"the",
"message",
"that",
"needs",
"to",
"be",
"signed",
"to",
"assert",
"that",
"pk",
"is",
"a",
"valid",
"key",
"for",
"id",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/packet/public_key_v3.go#L239-L252 |
149,998 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/armor/encode.go | writeSlices | func writeSlices(out io.Writer, slices ...[]byte) (err error) {
for _, s := range slices {
_, err = out.Write(s)
if err != nil {
return err
}
}
return
} | go | func writeSlices(out io.Writer, slices ...[]byte) (err error) {
for _, s := range slices {
_, err = out.Write(s)
if err != nil {
return err
}
}
return
} | [
"func",
"writeSlices",
"(",
"out",
"io",
".",
"Writer",
",",
"slices",
"...",
"[",
"]",
"byte",
")",
"(",
"err",
"error",
")",
"{",
"for",
"_",
",",
"s",
":=",
"range",
"slices",
"{",
"_",
",",
"err",
"=",
"out",
".",
"Write",
"(",
"s",
")",
... | // writeSlices writes its arguments to the given Writer. | [
"writeSlices",
"writes",
"its",
"arguments",
"to",
"the",
"given",
"Writer",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/armor/encode.go#L18-L26 |
149,999 | lavab/mailer | Godeps/_workspace/src/golang.org/x/crypto/openpgp/armor/encode.go | Encode | func Encode(out io.Writer, blockType string, headers map[string]string) (w io.WriteCloser, err error) {
bType := []byte(blockType)
err = writeSlices(out, armorStart, bType, armorEndOfLineOut)
if err != nil {
return
}
for k, v := range headers {
err = writeSlices(out, []byte(k), armorHeaderSep, []byte(v), newl... | go | func Encode(out io.Writer, blockType string, headers map[string]string) (w io.WriteCloser, err error) {
bType := []byte(blockType)
err = writeSlices(out, armorStart, bType, armorEndOfLineOut)
if err != nil {
return
}
for k, v := range headers {
err = writeSlices(out, []byte(k), armorHeaderSep, []byte(v), newl... | [
"func",
"Encode",
"(",
"out",
"io",
".",
"Writer",
",",
"blockType",
"string",
",",
"headers",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"w",
"io",
".",
"WriteCloser",
",",
"err",
"error",
")",
"{",
"bType",
":=",
"[",
"]",
"byte",
"(",
"block... | // Encode returns a WriteCloser which will encode the data written to it in
// OpenPGP armor. | [
"Encode",
"returns",
"a",
"WriteCloser",
"which",
"will",
"encode",
"the",
"data",
"written",
"to",
"it",
"in",
"OpenPGP",
"armor",
"."
] | a0901ff739bb9a5599f40133deaadb250ec834db | https://github.com/lavab/mailer/blob/a0901ff739bb9a5599f40133deaadb250ec834db/Godeps/_workspace/src/golang.org/x/crypto/openpgp/armor/encode.go#L133-L160 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.