Hi,
Sure, that sounds mostly right. The code really should be pretty easy, so there should be plenty of time to focus on making sure your code is correct, covers edge cases, and is clear and understandable. Therefore markers will expect a fairly high standard when it comes to those things, and to following secure coding best practices.
I will say, though, that whether the implementations should be "robust" is a bit more questionable. Normally when we say "robust", we mean that a program should handle errors gracefully. However, that usually applies only to whole programs, or to user-facing code (as opposed to developer-facing), or code that takes input that could potentially be malformed or from an untrusted source. In this project, there's only one function that falls into that category, namely cli
.
All the functions other than cli
have clear preconditions and postconditions, and the onus is on the developer calling them to ensure that the preconditions hold. If the preconditions don't hold, the result of the function will simply be undefined (and probably unexpected) – the only thing you can do if you do discover a precondition doesn't hold is use an assert()
call to abort operation.
For instance, consider something like the memcpy
function in the C library (see here). It's a requirement imposed on the caller that both arguments must point to valid locations in memory, and that they must not overlap, and that reading or writing n
bytes from them won't take you out of bounds. Is there anything you could or should do to make an implementation of memcpy
"robust"? I'd suggest there isn't, and in any case you shouldn't. However, I'll discuss this more in this week's lecture – stay tuned :)
Cheers
Arran
ANONYMOUS wrote:
> Hi all, Just checking if I understand the project right,
> so we need to implement encryption and decryption functions for both the Caesar and Vigenere ciphers, following the provided specifications in the crypto.h header file. Additionally, we'll create a command-line interface (CLI) function to facilitate easy testing of your code. Ensuring code quality by adhering to secure coding practices and proper documentation. Testing thoroughly and handling edge cases are essential for robust implementation.
> Is that's sound right?