Why `additionalProperties` is the way to represent Dictionary/Map in Swagger/OpenAPI 2.0

Chen, I think your answer is correct. Some further background that might be helpful: In JavaScript, which was the original context for JSON, an object is like a hash map of strings to values, where some values are data, others are functions. You can think of each name-value pair as a property. But JavaScript doesn’t … Read more

How to go from []bytes to get hexadecimal

If I understood correctly you want to return the %x format: you can import “encoding/hex” and use the EncodeToString method str := hex.EncodeToString(h.Sum(nil)) or just Sprintf the value: func md(str string) string { h := md5.New() io.WriteString(h, str) return fmt.Sprintf(“%x”, h.Sum(nil)) } note that Sprintf is slower because it needs to parse the format string … Read more

Best practice for hashing passwords – SHA256 or SHA512?

Switching to SHA512 will hardly make your website more secure. You should not write your own password hashing function. Instead, use an existing implementation. SHA256 and SHA512 are message digests, they were never meant to be password-hashing (or key-derivation) functions. (Although a message digest could be used a building block for a KDF, such as … Read more

What’s the best hashing algorithm to use on a stl string when using hash_map?

I worked with Paul Larson of Microsoft Research on some hashtable implementations. He investigated a number of string hashing functions on a variety of datasets and found that a simple multiply by 101 and add loop worked surprisingly well. unsigned int hash( const char* s, unsigned int seed = 0) { unsigned int hash = … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)