일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- WebView
- Scala
- ChromeTab
- sprintf
- design pattern
- template
- RAII
- kotlin
- async
- Clojure
- go
- Chrono
- stringprintf
- web
- haskell
- c++
- ranges
- AES
- Functional
- type_traits
- coroutines
- CustomTab
- sha256
- Reflect
- traits
- SHA1
- SHA512
- Android
- Observer
- program
- Today
- Total
프로그래밍 검색 블로그
go 에서 기본으로 제공하고 있는 패키지 중에 다른 언어에는 기본적으로는 없는 유용한 패키지중의 하나가 context 이다 context.Background() 기본적으로 Background()를 제외한 다른 context들은 다른 context를 받는데 기능 상으로 해당 인자로 준 context를 상속 받는다고 생각하면 된다 context의 동작은 조건이 충족되지 않을 시에는 Err() 함수의 반환값을 통해서 알 수 있다간단하게 nil이 아니면 에러 db 연결 부분은 제외하고 context만 사용하는 간단한 예제func main() { ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) defer cancel() //cance..
import java.io.File import java.io.FileInputStreamimport java.security.MessageDigestimport javax.xml.bind.DatatypeConverter fun digest(file: File, engine: String) : String{ val md = MessageDigest.getInstance(engine) FileInputStream(file).use { fi -> val bytes = ByteArray(4096) while (true) { val length = fi.read(bytes) if (length
package main import ( "crypto/aes" "crypto/cipher" "crypto/rand" "encoding/base64" "fmt" "io" ) type AESCipher struct { block cipher.Block } func NewAesCipher(key []byte) (*AESCipher, error) { block, err := aes.NewCipher(key) if err != nil { return nil, err } return &AESCipher{block}, nil } func (a *AESCipher) EncryptString(s string) string { byteString := []byte(s) encryptByteArray := make([]by..