<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Encoding on Gopher Coding</title><link>https://gophercoding.com/tags/encoding/</link><description>Recent content in Encoding on Gopher Coding</description><generator>Hugo</generator><language>en-gb</language><lastBuildDate>Sun, 02 Apr 2023 12:13:48 +0100</lastBuildDate><atom:link href="https://gophercoding.com/tags/encoding/index.xml" rel="self" type="application/rss+xml"/><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>How to Write Data to CSV in Go</title><link>https://gophercoding.com/saving-data-to-csv/</link><pubDate>Sat, 11 Feb 2023 13:00:00 +0000</pubDate><guid>https://gophercoding.com/saving-data-to-csv/</guid><description>&lt;p>In Go, you can use the standard library package &lt;code>encoding/csv&lt;/code> [&lt;a href="https://pkg.go.dev/encoding/csv">docs&lt;/a>] to write data to a CSV file. Below is a example that shows you how you can write a slice of user-data related strings to a CSV file.&lt;/p>
&lt;p>The code creates a new file called &lt;code>users.csv&lt;/code> and writes a slice of records to it. Finally, the Flush method is used to flush any buffered data to the underlying io.Writer, which is the file.&lt;/p></description></item><item><title>Convert HEIC to JPG in Go</title><link>https://gophercoding.com/convert-heic-to-jpeg-go/</link><pubDate>Sat, 17 Sep 2022 12:00:00 +0000</pubDate><guid>https://gophercoding.com/convert-heic-to-jpeg-go/</guid><description>&lt;p>The &amp;ldquo;High Efficiency Image File Format&amp;rdquo; or &lt;strong>HEIF&lt;/strong> is an image format often used by Apple devices. Although called HEIF, the file types are often &lt;strong>heic&lt;/strong> (&lt;em>presumably the &amp;lsquo;c&amp;rsquo; stands for container?&lt;/em>) They use a similar encoding method of video formats and are deemed better quality and lower file size than standard jpeg files.&lt;/p>
&lt;p>In our example, we&amp;rsquo;re trying to convert these &lt;code>heic&lt;/code> files back into &lt;code>jpg&lt;/code> files though - so we can use them elsewhere, display them or what ever we choose.&lt;/p></description></item></channel></rss>