Elektrine lite

โ† Feed

@shtrom@piaille.fr

2026-09-29 07:01 UTC

Licensing question: I'm re-implementing an encoding scheme in Rust. I have a GPL-2 reference implementation in C that I check against. The C source is 50-ish lines, the Rust reimplementation is 70-ish lines. Both are mainly a `switch`/`match` logic. How free am I to choose another permissive license for the reimplementation? As it's reimplementation of the algorithm, rather than copying the code, I don't think I'm bound by the GPL. I also haven't gone clean-room, as I was eyeballing the reference when writing the other, but I think that would only be relevant for patents. Not looking for binding opinions, just discussion. #freeSoftware #licensing

Replies (3)

  • @shtrom@piaille.fr Random comments from me would be If you take existing C code that is licensed under the GPL and rewrite or translate it into Rust, your Rust code is considered a derivative work under copyright law. The GPL would therefore seem to apply. If you go to the source algorithm and reimplemented it from scratch then you would probably need a clean room implementation. ๐Ÿ™‚๐Ÿ––

    Open ##4893603

  • @shtrom@piaille.fr 2026-09-29 07:02

    Note: No agent was allowed to go rogue and touch this code.

    Open ##5120891

  • @diazona@techhub.social 2026-09-29 10:35

    @shtrom@piaille.fr As a copyright nerd (not a lawyer), given that you have looked at the source code of the GPL implementation, then there's a definite chance your Rust implementation is a derivative work of the reference implementation. Derivative works don't have to be related by verbatim copying; at least in the US (which is the only perspective I can speak from), there's a legal test by which if you have access to a copyrighted work (e.g. looking at the source code) and produce another substantially similar work (such as an implementation of the same encoding scheme using a roughly similar approach), that's enough to prove copyright infringement. This is why companies and large organizations use clean-room reimplementations: it makes it very obvious that the people who made the substantially similar work didn't have access to the original. However, there's another legal principle called the merger doctrine which says that if the underlying idea, e.g. the algorithm you're implementing, can only be expressed in one way (or very few ways), then the expression - the code - effectively might not qualify for copyright protection after all. Otherwise, as soon as you read the source code of an implementation of a particular algorithm, you'd never be allowed to write that algorithm yourself. If that applies to your situation then you might be in the clear, but there's really no way to know without it going to court.

    Open ##5120894