Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

The Brotherhood 

Lock/Unlock - Protect - Encrypt Your Files - Microsoft AES 256 File Encryption

[Image: header4.gif]

[Image: icon-1.png] Microsoft AES 256 File Encryption (MS-AES-256-FE.exe)[Image: icon-1.png]

Encryption is crucial for ensuring data privacy and protecting sensitive information from unauthorized access. It plays a vital role in maintaining personal security by safeguarding digital communications and stored data. Robust encryption practices help prevent data breaches and cyberattacks, ensuring that personal and confidential information remains confidential. In an increasingly digital world, the importance of encryption for data privacy and personal security cannot be overstated.



This simple program can take any type of file, encrypt it with AES-256 using Windows, and bcrypt functions. It is a simple CLI program that takes the parameters for your file, password, and lock/unlock commands.

This code share is meant to guide you so you can create your own encryption related programs.


Source Code
Spoiler (Click to View)



Usage:
Code
MS-AES-256-FE.exe <filename> <password> <lock/unlock>
Microsoft-AES-256-File-Encryption-x86.exe <filename> <password> <lock/unlock>
Microsoft-AES-256-File-Encryption.exe <filename> <password> <lock/unlock>

Encrypt / Lock a file:
Code
MS-AES-256-FE.exe ./test.txt hello-world lock
This will create ./test.txt.locked

Decrypt / Unlock a file:
Code
MS-AES-256-FE.exe ./test.txt.locked hello-world unlock
This will create ./test.txt.locked.unlocked






Inspired by AESCrypt :
Quote:AESCrypt implementation of Microsoft Cryptography API, encrypt/decrypt with AES-256 from a passphrase.
https://github.com/hackerhouse-opensource/AESCrypt



AI Generated Description of Source Code:
Spoiler (Click to View)



If you like this small, single-file solution to protect your files by locking & unlocking / encrypting with a passphrase, using MS AES-256 encryption then please let me know if you have any questions or comments in this thread.
Great post mate. I've never delved much in cryptography so I'll be sure to add this to my notes. Thank you
[Image: brotherhood.gif]
Fantastic nodes, great share and very helpful/useful. Appreciate it brother
#1 HF BYTES SHOP! TRUSTED! [4,100+ CRED] SELLING & BUYING! BEST PRICES & FAST DEALS!

Click The Link Below For More Info!

https://hackforums.net/showthread.php?tid=6191815
(Jul 20, 2024 01:59 PM)Dystortion Wrote:  Great post mate. I've never delved much in cryptography so I'll be sure to add this to my notes. Thank you

(Jul 20, 2024 04:53 PM)Tsar Wrote:  Fantastic nodes, great share and very helpful/useful. Appreciate it brother

Thanks guys, just wanted to do something - had been a bit since I posted any C++ code

It’s so easy to protect a file too, but many people save passwords and keys in plaintext. My hope is that someone can use this for their own security. The other thing is that it’s not relying on a lesser-known AES library like my previous file encryption codebase I shared on HF.
(Jul 21, 2024 04:37 AM)Hackers Wrote:  Thanks guys, just wanted to do something - had been a bit since I posted any C++ code

It’s so easy to protect a file too, but many people save passwords and keys in plaintext. My hope is that someone can use this for their own security. The other thing is that it’s not relying on a lesser-known AES library like my previous file encryption codebase I shared on HF.

nice one, i've been following you so far(not stalking, just following your content) and it looks very genuine to me, code looks ok, documentation looks ok, i also noticed something that i also do, im referring to use gpt for documentation, i do it sometimes not always, maybe when i have no time or i didn't write any comment at all and the code is large then i would use gpt for the documentation cuz im lazy, but this is the only thing i can do with gpt, for coding snippets i actually NEVER saw a good gpt poc :).
about the code, i would separate lock and unlock into multiple units, this is just my personal opinion, im not holding any fact just opinions, the reason is because sometimes you only need 1 or the other, and if for example this gets injected by the mean of steganography byte poisoning into a .png(.jpeg or .jpg might not work as intended because they're lossy and for stego poisoning you need lossless compression), the code needs to be small, that is the case where you might prefer to have only one module for unit, but i guess that wasn't the purpose anyway, im just making a concept, this concept doesn't mean that x is better then y but only a concept reflecting a point of view of the context based on events, i do also agree that sometimes having all in one unit is good, i would like to tell you that i appreciate your huge contribution on the forum, i see you in many places all over and everything you share seems genuine... !
Edited: i edit this because i just saw your source code, with all respect, i would like to give you some insights on where you can improve or correct code, im just trying to help not criticizing the code:

1) when initializing variables either mutable or constant, use direct initialization instead of copy initialization, the reason is because copy initialization requires more operations then direct initialization, at high level this isn't obvious because they seem to be the same.
2) not proper const usage, use const if you can, const data goes in ".rodata" registers, means it is faster to read, being allocated on the stack, stack is faster then heap but i guess u already know. when you allocate const data, you're referring to ".rodata" register sectors which are faster bcz they get allocated on faster cache line like L1 caches, which is the fastest cache line but smaller, while read-write data goes on ".rwdata" which is slower cuz it gets allocated on slower caches like L2, L3...
3) you're missing some good attributes, there are attributes u can use like __attribute__((ATTRIBUTE_NAME)) or if you prefer more modern and newer syntax you can go with [[ATTRIBUTE_NAME]] variant, both are the same but __attribute__((x)) has more options available, the only weak point is compiler support, both clang and gcc have different options available, so you need to be careful what you're with __attribute__((x)), use [[ATTR_NAME]] instead, look at the following example:

Code
// good code but not so performant...
int16_t x(0);
if(x > 0) {
... something
}

// same code but more performant
if(x > 0) [[likely]] {
... something
}

// OR
if(x < 0) [[unlikely]] { // unlikely because x is signed but we know that is highly improbable that will be < 0
... something
}
// this is called compiler optimization, and the compiler will thank you for this ;)


another example will be with function inline optimization:

Code
// weaker syntax
static bool FrequentCheck() {
return true;
}
// let's say FrequentCheck is a small function performing easy tasks that wont throw any error...
__attribute__((hot)) [[nodiscard]] static const bool FrequentCheck() noexcept {
return true;
}
// if the function is not called so often...
__attribute__((gnu::cold)) [[nodiscard]] static const bool FrequentCheck() noexcept {
return true;
}

there are a dozen of possible attributes you can use to improve the code... obviously i know that the compiler does improvements all over the code, but does not always make the best decisions because it doesn't know exactly where and how the code behaves in certain ways, also.... it will be harder to read and maintain but this is the only way you ensure best performance for your code... especially for cryptographic operations that require quite more computations... but don't worry, i actually encounter very often c/c++ programmers who know the existence of inline optimization attributes, what i see is just like 1/10 actually do use them, and if they do, they do it wrong way, i've seen things like __attribute__((hot)) and [[gnu::cold]] together.. which doesn't make any sense because one is saying "high frequency execution" while the other "low frequency execution", if you want to use them, make sure they're correct :), thank you for your understanding, im just another crazy lazy motherfucker :)
(Jul 23, 2024 05:32 AM)secret_code Wrote:  nice one, i've been following you so far(not stalking, just following your content) and it looks very genuine to me, code looks ok, documentation looks ok, i also noticed something that i also do, im referring to use gpt for documentation, i do it sometimes not always, maybe when i have no time or i didn't write any comment at all and the code is large then i would use gpt for the documentation cuz im lazy, but this is the only thing i can do with gpt, for coding snippets i actually NEVER saw a good gpt poc :).
about the code, i would separate lock and unlock into multiple units, this is just my personal opinion, im not holding any fact just opinions, the reason is because sometimes you only need 1 or the other, and if for example this gets injected by the mean of steganography byte poisoning into a .png(.jpeg or .jpg might not work as intended because they're lossy and for stego poisoning you need lossless compression), the code needs to be small, that is the case where you might prefer to have only one module for unit, but i guess that wasn't the purpose anyway, im just making a concept, this concept doesn't mean that x is better then y but only a concept reflecting a point of view of the context based on events, i do also agree that sometimes having all in one unit is good, i would like to tell you that i appreciate your huge contribution on the forum, i see you in many places all over and everything you share seems genuine... !

Thanks for your comment!
I did use GPT to refactor some of this from that AESCrypt library. You are right that the compression & exact methods could be separated out. I treated it as more like on/off or encrypt/decrypt and kept it all in one.

For me, the thing I got out of this was using bcrypt lib instead of others like I have in past:

I had used a custom, but not well known AES library in past for SFED (Single File Encryption & Decryption): https://github.com/LNodesL/SFED-AES-256
I then used the same AES lib for NCrypt: https://github.com/LNodesL/NCrypt
I used XOR for Sonofa - https://github.com/LNodesL/Sonofa-Byte-Crypting-Program
XOR in Espana - https://github.com/LNodesL/EspanaKrypt

I have used a ton of other algos in other langs, but hadn't used bcrypt in C++ yet.

I like to pick mini projects to try new things, and sometimes I'll release on HF for the sole sake of sharing because otherwise it'll end up in an archive folder on my PC, never to be opened again.

I appreciate your kind words!! I'm glad people find my content useful. I'm currently juggling my research into the Sumerian tablets with learning C++, and working on some other projects too.
(Jul 23, 2024 05:42 AM)Hackers Wrote:  Thanks for your comment!
I did use GPT to refactor some of this from that AESCrypt library. You are right that the compression & exact methods could be separated out. I treated it as more like on/off or encrypt/decrypt and kept it all in one.

For me, the thing I got out of this was using bcrypt lib instead of others like I have in past:

I had used a custom, but not well known AES library in past for SFED (Single File Encryption & Decryption): https://github.com/LNodesL/SFED-AES-256
I then used the same AES lib for NCrypt: https://github.com/LNodesL/NCrypt
I used XOR for Sonofa - https://github.com/LNodesL/Sonofa-Byte-Crypting-Program
XOR in Espana - https://github.com/LNodesL/EspanaKrypt

I have used a ton of other algos in other langs, but hadn't used bcrypt in C++ yet.

I like to pick mini projects to try new things, and sometimes I'll release on HF for the sole sake of sharing because otherwise it'll end up in an archive folder on my PC, never to be opened again.

I appreciate your kind words!! I'm glad people find my content useful. I'm currently juggling my research into the Sumerian tablets with learning C++, and working on some other projects too.

no problem, im trying to give some of the contribution, that's all, exchanging opinions is always a smart thing to do, who don't share opinions will never make progress in my point of view, so is important, i edited the previous comment as i was reading the source code i spotted different areas with possible space for improvement, again, just optimizations not corrections... you're doing good actually...
(Jul 23, 2024 06:26 AM)secret_code Wrote:  no problem, im trying to give some of the contribution, that's all, exchanging opinions is always a smart thing to do, who don't share opinions will never make progress in my point of view, so is important, i edited the previous comment as i was reading the source code i spotted different areas with possible space for improvement, again, just optimizations not corrections... you're doing good actually...

agreed, always good to share knowledge and discuss
Shame you are no longer with us and it looks like you requested to be banned permanently. :(
I'm Stanley HF's helper bot. The OP (original poster) of this thread wants everyone to see this page and has elected to bump it to the top of the showthread listing. Since HF doesn't want a ton of LQP (Low Quality Posts) this is the best method of bumping your content. There is a small βyte fee for each bump. Any OP can bump any of their threads on HF from the linked icon on the top of their first post.

If you haven't already read the first post of this thread we encourage you to do so.

Thanks,
Stanley
I am the official HF Help Bot.  You might get an automated PM from me with some helpful information.
Please read our Help Docs.
Happy to help explain anything if someone has a question!


Possibly Related Threads...
Thread / Author Replies Views Last Post
by G_LockAug 7, 2026 07:24 AM 9 533 Aug 7, 2026 07:24 AM
Last Post: Statix0d
by lordlogicApr 14, 2026 02:04 PM 8 309 Apr 14, 2026 02:04 PM
Last Post: timmi888
by HackersMar 14, 2026 11:31 AM 30 1,450 Mar 14, 2026 11:31 AM
Last Post: Hackers