Artem's blog

Mainly .NET (C#, ASP.NET) and my projects

Archives for Programming Tips

Sample of Bubble sort

The MsgBox is there to show how it actually goes through the integer array. You can remove it as well!

MsgBox function for C#

SKBL [2009]

Three years ago, I did one of my first project that is used to secure .NET Applications. It is called SKBL – Serial Key Builder Library. It works in both Visual Basic and C#.

You may download it here! (The documentaion file is included.)
SKBL Setup

If you have some questions, please ask me at “artem.los at nilssons.ws”

Happy New Year!
Artem Los.

Tip of 22 December

In this thread I will show you two good Java Script functions. With both of them you can calculate how many chars you have.

The first one will calculate a specific element.

 

The second one will calculate all chars between HTML tags. HTML tags are not included.

or

 

You might however replace innerHTML to outerHTML as shown bellow. This will therefore calculate all document. (does not work in Firefox)

Another example of an encryption algorithm [JS]

In this post I will go through a simple encryption method I’ve done few years ago. It is actually so simple, but I’ve heard that some currently-used encryption algorithms are based on this principle.

Here is the code: (function “ec_t” – encryption method; function “dc_t” – decryption method)

If you want to view this code in-work, enter the link below:
Encrypter

Why and how did it work?
The code above works on a simple principle, I discovered it without looking at internet, though! šŸ˜›

Say we have a table where all letters have an id, i.e., a number. The table looks as follows: A-1, B-2, C-3 …
First of all, we need to define our message, say we have “BAC” corresponding to “213”.
Then we need a key, say “CBA” – “321”. (it is in the same format as the message).

B(2) A(1) C(3)
C(3) B(2) A(1)
D(4) C(3) E(5)

The result is therefore 435 or DCE. When we decrypt we have to do the same but backwards, using the key, i.e., instead of addition use subtraction.

This is done with function “ec_t” and “dc_t”.
If the message is longer than the key, then we need to duplicate the key so it matches the message length. All that is done in function “getKey”.

It is better that you use function “do_e” instead of “ec_t”, because then all letters will go through a escape function, which means that the text will be more copy-friendly, i.e., easier to copy without missing some letters which can affect the result.

Good luck!

Create a HTML document

Tips of 23 November [JS]

So, today I will show some useful codes that might be used for protecting information with Java Script.

1. First of all, the most common protection method is to disable the right-clicking, i.e. disallow user to copy stuff from a webpage.

So, by using the code above you can be ensured that your information is safe at a basic level. It can still be taken by looking at the source, and copying it therefrom.
I will try to publish another code that actually protects the whole website, but remember that even though you got your page encrypted, it might still be cracked. Like with all kinds of protections, it is all about the time!

2. Another tip that I will talk about is links. It is so often that robots takes the, for instance, email address, and use it for spamming. However, we may solve this issue! Here I’ve got to methods that may help you to protect your links.

In the body of the page, enter:

To improve this code, you can for example encrypt the link. I would recommend the escape/unescape function, but It actually does not matter. Once again, it’s all about the time.

The second method is not so useful, though. It is only working in Internet Explorer, and it have actually now function, just to hide the status bar.

Tips of the day 21 November 2011

Welcome to Tips of the day! Here our some cssĀ components people asks about.
Code 1:

Code 2:

Code 3:

Straddling Checkerboard [Java Script]

This tutorial will show you how you can encrypt/decrypt text (string) with Java Script or JScript.

First we need a table, even called for matrix. To create a matrix I chose to combine three array-lists into one single. (Note that it also works without the combining of arrays!)

Encryption Method:

Decryption Method:

Copyright (C) 2011 Artem Los

CRC32 Method [VB.NET]

Please take a look over the code I’ve founded atĀ http://dotnet-snippets.com/dns/calculate-crc32-hash-from-file-SID587.aspx.
The author of this code is Tim Hartwig. If you want to read more about the code/algorithm, please go here!

Page 4 of 4:« First« 1 2 3 4