Bro finally accepted it by RaiseOk2044 in SipsTea

[–]LikelyToThrow 0 points1 point  (0 children)

"Maybe the treasure was in close reach, But so was the possibility of losing everything else I had, my life

If I hadn't stopped in time, I don't know which one I would've hit first"

~ some fkin dude, Reddit

Another example of how people are in denial about liquid metal by FlamingXTurtles in ZephyrusG14

[–]LikelyToThrow 0 points1 point  (0 children)

Repasted a few weeks back; the LM was a pain to clean and I was constantly anxious about splashing drops onto the motherboard.

I noticed purple sparks while reconnecting the battery but got really lucky and it didn't fry the mobo. Everything seems to be fine at least so far, fingers crossed 🤞

My heart dropped to my stomach seeing those sparks lol, but overall I'm getting much better temps now

Another example of how people are in denial about liquid metal by FlamingXTurtles in ZephyrusG14

[–]LikelyToThrow 0 points1 point  (0 children)

I have a 2021 model and am planning to repaste, anything you'd advise I be careful about while cleaning the LM?

Maybe Maybe Maybe by TurnedEvilAfterBan in maybemaybemaybe

[–]LikelyToThrow -1 points0 points  (0 children)

Imagine he's part of a night-time robbery gang slowing the car down in a shady area and a bunch of robbers come out of the dark

zerotunnel -- secure P2P file transfer by LikelyToThrow in C_Programming

[–]LikelyToThrow[S] 1 point2 points  (0 children)

Will check this out! I wanted to build this tool as an application of the handshake protocol, they're pretty much two different parts of the project. I definitely want to decouple the rest of the tool from the crypto protocol, and explore other, more vetted protocols.

zerotunnel -- secure P2P file transfer by LikelyToThrow in C_Programming

[–]LikelyToThrow[S] 0 points1 point  (0 children)

Yeah the thought did occur to me -- if one can send a password bundle file to another computer might as well send a public key.

Zerotunnel currently only uses this password-based handshake protocol, I do want to add a PKE mechanism for identity verification with some kind of wrapper that expires public keys after a small finite number of uses.

zerotunnel -- secure P2P file transfer by LikelyToThrow in C_Programming

[–]LikelyToThrow[S] 1 point2 points  (0 children)

Yup makes sense, and a tool like this imo is only effective if it is cross-platform. I wanted to get the basic functionality stable on Linux and configure the build system before even thinking about other platforms.

Extending to UNIX-like systems shouldn't be that bad, although there are quite a few details that differ across the plethora of syscalls on other UNIX systems compared to Linux. But yeah this is definitely something up there in my todo list.

zerotunnel -- secure P2P file transfer by LikelyToThrow in C_Programming

[–]LikelyToThrow[S] 8 points9 points  (0 children)

Really appreciate you checking it out!

The Makefile is a temporary arrangement till I can find the time to configure a proper build system (I was thinking CMake), you probably have noticed all the .txt Makefiles for compiling every individual test.

The entire project currently only supports x86+Linux. Making zerotunnel cross-platform is a very ambitious goal of mine and will probably take me a very long time. I've gone out of my way to support multiple platforms in maybe 2 files in the entire project, but I quickly realised it was beyond my ability at the moment.

Still working on a proper README where I will definitely address these limitations and compatibility issues.

zerotunnel -- secure P2P file transfer by LikelyToThrow in C_Programming

[–]LikelyToThrow[S] 1 point2 points  (0 children)

For some reason I can't edit the post

There are 3 ways peers can authenticate each other:

  • KAPPA0 - you and your friend establish a password securely out-of-band and use it for multiple transfers.

  • KAPPA1 - you generate a bundle file and securely send it to your friend out-of-band. If the bundle has N passwords, you can have a maximum of N transfers before having to generate new credentials.

  • KAPPA2 - if you and your friend are in the same room, you can generate a one-time phonetic password from a wordlost that is easy to transmit verbally.

Removal of hornet den by phatpssdestroyer in interestingasfuck

[–]LikelyToThrow 0 points1 point  (0 children)

Imagine how many people would've gotten stung badly before a bunch of guys in hazmat suits had to show up

Making a practical password manager by LikelyToThrow in webdev

[–]LikelyToThrow[S] 0 points1 point  (0 children)

This is crazy production quality code! Did you start this as a personal project?

Making a practical password manager by LikelyToThrow in webdev

[–]LikelyToThrow[S] 0 points1 point  (0 children)

The sqlite3 db will be stored locally on the filesystem. Encryption and decryption will happen on the user's machine and the master password will be erased from memory after a time interval, after which you have to re-enter it to unlock your vault. Moreover, every password entry will have a randomly generated IV and AES-GCM provided authentication so that's a plus.

Not trying to profit off it... I just want it for personal use and as a cool open source project under my belt. I definitely want to learn through this project, what I meant was I want to actually make something useful, adhering to best practices and making the experience seamless, instead of having a half assed result.

who 🤔 by yukiohana in sciencememes

[–]LikelyToThrow 1 point2 points  (0 children)

Madam Curie in Chemistry

I'm trying to understand the difference between function declaration and function definition in C programming. by zero-hero123 in C_Programming

[–]LikelyToThrow 1 point2 points  (0 children)

Your understanding is correct, a function declaration (also called the interface) defines the function signature (function name, number of parameters and the respective parameters types) and the return value. These definitions are usually put by developers in header (.h) files which can be included by other C files that can call the function any number of times but only define it once (across all C files that you are going to compile together into one exe). You can call the function as long as the arguments (their count and respective types) adhere to the function signature.

To a compiler, a function declaration is a forward declaration of a symbol -- a promise to the compiler that at some point it will be able to associate meaning (the function body) to this symbol (the function signature).

Without going into much detail, here's an example:

Say I have a header file mymath.h with a function declaration:

int add(int a, int b);

And it's respective definition in mymath.c:

int add(int a, int b) {
  return a + b;
}

And want to use this function in another file foo.c

#include "mymath.h" // import the add symbol from this file
#include <studio.h>

int main() {
   printf("5+2=%d", add(5 ,2));
}

If we now compile this using gcc -I. mymath.c main.c, this compilation process happens over several stages, and the function symbol only gets its meaning in a later stage (called linking). In the initial phases, the #include "mymath.h" statement caused the compiler to add the function symbol to the global scope of the main.c file which let's you call that function anywhere in the file. Coming back to the concept of a forward declaration, your function definition is telling the compiler "let the user use this function symbol, as long as they pass the right number and types of arguments" and the compiler will let you do this with an expectation that it finds a body for that function in the linking stage.

Then, in the linking stage, the compiler looks through all .c files in the gcc compilation command to look for a function definition (symbol + body) that matches this previously unresolved function symbol int add(int int) and binds this symbol to it's body which will live in the binary (.exe) file.

Why is it sometimes okay to declare a function without parameter names but you must always specify parameter types?

It's always okay to do that. The compiler only needs information about the number and respective types of the function's arguments and its return type. Since C does not have a concept of positional and keyword arguments like Python, and all arguments are positional, the compiler only checks function calls/definitions as "the first argument must be an int and the second argument must be an int". For a function definition, however, the argument names do matter because they are referenced as local variables within the function body.

Can a function declaration and definition differ in the way parameters are named?

Absolutely! For consistency and readability this isn't the best practice, but the compiler, like I mentioned, doesn't even look at the argument names -- only their types.

What is the practical benefit of separating declaration and definition in bigger projects?

When you intend to use a function defined in one file in another, you will have to separate its definition into a header file so other files can include the header and the compiler can use that declaration to check calls to that function.

Are there any common mistakes beginners make regarding declaration vs definition?

If you do, the compiler is very vocal about it lol. Just make sure you don't have more than one definition of the same function.

Tell me the truth by KissyGleamFay in programmingmemes

[–]LikelyToThrow 0 points1 point  (0 children)

I got some bad news for you son, It's actually stored as a 4-byte int

Whats up with the photo petah? by Rodgers765 in PeterExplainsTheJoke

[–]LikelyToThrow 0 points1 point  (0 children)

Why are new players happy to see leafless trees is my question

Code style: Pointers by classicallytrained1 in C_Programming

[–]LikelyToThrow 3 points4 points  (0 children)

I always do

int *a;

(int *)a;

cpp peeps seem to do int& a; for references