<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>String on Gopher Coding</title><link>https://gophercoding.com/tags/string/</link><description>Recent content in String on Gopher Coding</description><generator>Hugo</generator><language>en-gb</language><lastBuildDate>Sun, 12 Nov 2023 16:47:48 +0000</lastBuildDate><atom:link href="https://gophercoding.com/tags/string/index.xml" rel="self" type="application/rss+xml"/><item><title>Generating UUIDs in Go</title><link>https://gophercoding.com/generate-uuids-in-go/</link><pubDate>Sun, 12 Nov 2023 15:00:00 +0000</pubDate><guid>https://gophercoding.com/generate-uuids-in-go/</guid><description>&lt;p>UUIDs (&lt;a href="https://en.wikipedia.org/wiki/Universally_unique_identifier">Universally Unique Identifiers&lt;/a>) serve as a standard for generating identifiers that are &lt;strong>unique across time and space&lt;/strong>. In this blog post, we&amp;rsquo;ll explore how to generate UUIDs in Go using the &lt;a href="https://github.com/google/uuid">google/uuid&lt;/a> package. These can be especially useful when generating IDs across different systems - where it wouldn&amp;rsquo;t be possible to track using an auto incrementing integer.&lt;/p></description></item><item><title>SHA3 Hash in Golang (256-bit)</title><link>https://gophercoding.com/sha3-encode-in-golang/</link><pubDate>Sun, 12 Feb 2023 09:30:00 +0000</pubDate><guid>https://gophercoding.com/sha3-encode-in-golang/</guid><description>&lt;p>You can use the &lt;code>golang.org/x/crypto/sha3&lt;/code> [&lt;a href="golang.org/x/crypto/sha3">docs&lt;/a>] package to perform SHA-3 encoding on a string. We have an example function below, it will take your string and write it as a hash. Then convert that binary back into a hexadecimal string using &lt;code>Sprintf&lt;/code>.&lt;/p>
&lt;h2 id="advantages-of-using-sha3">Advantages of Using SHA3&lt;/h2>
&lt;ol>
&lt;li>
&lt;p>&lt;strong>Security&lt;/strong>: SHA-3 was designed to provide higher security compared to SHA-2 by using a different construction called &amp;ldquo;sponge construction&amp;rdquo;, which makes it more resistant to various types of attacks, such as collision and preimage attacks.&lt;/p></description></item><item><title>MD5 Encoding in Golang</title><link>https://gophercoding.com/md5-encode-in-golang/</link><pubDate>Sun, 12 Feb 2023 09:00:00 +0000</pubDate><guid>https://gophercoding.com/md5-encode-in-golang/</guid><description>&lt;p>You can use the &lt;code>crypto/md5&lt;/code> [&lt;a href="https://pkg.go.dev/crypto/md5">docs&lt;/a>] package in Go to perform MD5 encoding on a string. We have an example function below, it will take your string and write it as a hash. Then convert that binary back into a hexadecimal string using &lt;code>Sprintf&lt;/code>.&lt;/p>
&lt;p>&lt;strong>Note:&lt;/strong> There are &lt;a href="https://security.stackexchange.com/questions/19906/is-md5-considered-insecure">more modern approaches&lt;/a> than md5 these days - and it isn&amp;rsquo;t recommended for many things, but definitely not password hashing.&lt;/p>
&lt;p>Here&amp;rsquo;s an example of how to use it:&lt;/p></description></item><item><title>Convert an io.ReadCloser to String</title><link>https://gophercoding.com/convert-readcloser-to-string/</link><pubDate>Sat, 01 Oct 2022 07:00:00 +0000</pubDate><guid>https://gophercoding.com/convert-readcloser-to-string/</guid><description>&lt;p>Using Go, we often make HTTP calls these days using &lt;code>net/http&lt;/code>, which result in a response of type &lt;code>io.ReadCloser&lt;/code>&amp;hellip; which are hard to read for the layman (like me). What we really want to the response in the form of &lt;strong>a string which we can read&lt;/strong>. This post will talk about how to convert these &lt;strong>ReadCloser&lt;/strong> into strings.&lt;/p>
&lt;p>First we&amp;rsquo;ll look at the problem, then we have two different solutions.&lt;/p></description></item></channel></rss>