学习伽罗华域,造福大众(00)
Learn You Galois Fields for Great Good (00) (2023)

原始链接: https://xorvoid.com/galois_fields_for_great_good_00.html

本系列课程介绍抽象代数,重点讲解伽罗瓦域及其在计算机科学中的应用,填补了易于理解的学习资源的空白。课程避免过度简化或依赖复杂的数学术语,采用循序渐进的方法,并提供实际代码示例。 抽象代数探索超越特定数字的数学关系,使我们能够通过编码、加密和错误检测来操作数据。本系列课程将涵盖必要的理论基础,逐步深入到Reed-Solomon码和AES等应用。 课程强调主动学习,包含练习和使用Rust语言编写的代码示例,有意避免优化以提高清晰度。目标是易于理解,创建参考实现。鼓励读者实践所学概念并使用提供的工具进行实验。未来的主题可能包括Rabin指纹和椭圆曲线等高级主题。

Hacker News上的一篇文章讨论了一篇题为“为了更大的利益,学习伽罗瓦域”的博文,该博文因其对伽罗瓦域清晰简洁的解释而受到好评。评论者赞赏其易于理解的方法,并将其与更复杂的论述形成对比。一些人指出它受到了“Learn You a Haskell”的启发,并建议结合使用GAP、MAGMA、Maxima或Mathematica等工具。一些评论者指出,文中没有明确提及域的封闭性属性。伽罗瓦域在计算机科学应用中的重要性,例如纠删码、密码学和数据哈希,也得到了强调。关于抽象代数在计算机科学课程中的普及程度存在争议,人们对数学辅修是否标准存在不同意见。总的来说,这篇文章因使抽象代数更容易被程序员理解而受到好评。
相关文章

原文

Navigation | first | next

This is the introduction to a series on Abstract Algebra. In particular, our focus will be on Galois Fields (also known as Finite Fields) and their applications in Computer Science. This is a project I've been excited about for many years now, but have been too busy to dedicate the adequate effort to meet my perfectionism standards (yay perfectionism!).

Backstory

Many moons back I was self-learning Galois Fields for some erasure coding theory applications. I was quite disappointed with the lack of accessible resources for computer scientists. Many resources assumed either:

  1. Its beyond your skill level so let's oversimplify ("it's hard, don't worry about it"), or
  2. You had prior Pure Math studies in Abstract Algebra ("it's easy, just use jargon jargon jargon")

Unfortunately, Abstract Algebra is not standard subject matter in most computer science curriculums. Often computer science mathematics start and end with Discrete Math. If you're lucky, maybe you've also been exposed to Linear Algebra.

So, ultimately, I ended up self-learning Abstract Algebra from a pure math textbook. But for the great majority of computer scientists, there has to be a better way. This series intends to fill this gap. This is the gentle step-by-step approach with applications implemented with actual code. It's the intro I wanted when I was starting out.

What is this subject?

Abstract algebra is a beautiful subject. It's the idea that the numbers you're familiar with don't matter. The numbers are just arbitrary labels. What matters is the relationships they have with other numbers when you add or multiply them. If the numbers don't matter, then we can swap those labels for different labels and all the normal math rules will still work.

For example, we could create an algebra that allows us to add or multiply colors:

a double rainbow?

And this is what makes the subject abstract and confusing. How can you just say that numbers don't matter? It doesn't make sense.

even jackie struggles at math

And even so, why would we want to study this? Why would a computer scientist care?

Well, we use computer algorithms to manipulate data. We encode/decode it, we encrypt/decrypt it, we detect corruption, etc. Wouldn't it be great if we could use normal math to do those things? Wouldn't it be great if would could add or multiply an 8-bit byte by an 8-bit byte and get another 8-bit byte? And if we could do that, could we also do Linear Algebra over Data? Yes, yes, and more yes. This is why studying Abstract Algebra is worthwhile.

color me 42

(Hint: Neither 263 nor 9282 are answers, they are not 8-bit numbers)

You can also make quirky blog posts that make your friends think you've gone crazy, like milk and cookies 🥛 🍪 😊

Applications

The applications and algorithms are staggering. You interact with implementations of abstract algebra everyday: CRC, AES Encryption, Elliptic-Curve Cryptography, Reed-Solomon, Advanced Erasure Codes, Data Hashing/Fingerprinting, Zero-Knowledge Proofs, etc.

Having a solid-background in Galois Fields and Abstract Algebra is a prerequisite for understanding these applications.

Approach: Step-by-step, Active Learning, and Literate Programming

In this series, we will start from the very basics of theory and build up step-by-step to interesting applications such as Reed-Solomon, AES, etc. As such, the material will be very cumulative. Many exercises will be included to aid understanding. Each section will build gradually, but will assume mastery of the previous section. Active learning is strongly encouraged. We will expect that readers are putting in adequate effort to grok the abstract concepts.

We won't assume too much mathematical background beyond high-school level algebra. However, in some applications (for example: Reed-Solomon), familiarity with Linear Algebra will be required. We won't explain Linear Algebra since great resources already exist here. You are encouraged to supplement as needed.

We will be including code in a Literate Programming style where appropriate. For example, to aid understanding, we will build some interactive command-line tools that allow you to play around with various theoretical concepts in practice. All code will be the Rust Programming Language, but advanced features will be intentionally avoided so that the code will be readable by most experienced computer programmers.

The main goal of this series is understandability and education. As such, the implementations will not be optimal. We will forgo nearly all optimizations you'd see in a production quality implementation: lookup-tables, vectorized instructions, clever representations, computer architecture optimizations, etc. It's possible that later posts in the series will discuss optimizations, but this is not a primary goal. At the end, we hope these implementations will serve as good reference implementations. This can have it's own merit since highly optimized algorithms are often difficult to read and understand.

For active learning, I strongly encourage you to do your own implementations and to play around with the command-line tools while reading. If you'd like to open-source your implementations, I'm more than happy to link them here:

  • Original: xorvoid (Rust): here

Planning is Essential, Plans are Worthless

Here's the rough plan. We will see how it actually goes:

Other possible advanced subjects:

  • Rabin Fingerprinting
  • Extended Euclidean Algorithm
  • Log and Invlog Tables
  • Elliptic Curves
  • Bit-matrix Representations
  • Fast Multiplication with FFTs
  • Vectorization Implementation Techniques

The first few sections are theory. There's not much coding in these sections, but they are very important for success later in the series. Don't skip them.

Let's get started!

联系我们 contact @ memedata.com