Artem's blog

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

Archives for Old clizware.net blog

Express exponential functions in base e

In order to express an exponential function in terms of e, we need to do as follows:

logarithms1

This was simple, but it might be used to prove the compound formula in calculus.

logarithms2

First, we convert the expression into base e.

logarithms3

Secondly, we know that the D(e^x)=e^x. So,

logarithms4

But, this is the same as:

logarithms5

QED

Software Protector [Identical key generation]

Mathos Project website updating

Mathos Project websites, http://mathosproject.com/ and http://mathosproject.info/ are for the moment under a big update, and hence not available for the moment. This will be fixed 31/1, but it might take longer time depending on several factors.

Please check back soon! 🙂

Update of SKGL API 2.0.4.1

For approximately one week ago, I released a newer version of the SKGL API. This update has no significance to the way you’ve used Software Protector and SKGL before, however, keys generated in the previous versions will not be validated in this release.

This is mainly because of the change to a part of the algorithm that caused a small bug, which was mentioned here.

Fortunately, this bug is fixed, so you can continue to protect your ideas with Software Protector! 🙂

P.S. Please check out the Facebook page at https://www.facebook.com/SoftwareProtector

Interesting features of numerical roots

Imagine following: you ask your fellow to pick any number they like, and later multiply it by your number. Once they have the result, you will ask them to circle one digit in their answer (except zero). Finally, you ask them to tell you digits that are left in any order, and you will be able to tell the circled digit.

This is simply done using some basic concepts of numerical roots. Once you know these, you will be able to construct different kinds of tricks, based on this principle.

Numerical root: A numerical root is calculated by summing up the digits in a number. Say we have 85732, so the numerical root will be 8+5 which gives you 13. Then, because 13 is bigger then 10, you take 1+3 to get 4, and add it to 7 (the third digit). So, 4+7 = 11, hence 1+1=2. Now 2+3=5, and 5+2=7. So, the numerical root of 85732 is 7. (if you know modulo arithmetic, you simply take the sum modulo 9, i.e. 8+5+7+3+2 mod 9 = 7, however, the described method is handy because it does not require that much calculations)

Interesting feature: If the numerical root is equal to 9, you can perform either addition and/or multiplication of any random number, and the numerical root will still stay the same. This is interesting because you can let your fellow to add or multiply your number with any number, any amount of times, and still know that the numerical root is 9. Let’s see how this works:

If I pick a number with a numerical root of 9, i.e. 54, and you pick 9876 (which I obviously do not know), and later you multiply these two together, and get 533304. I ask you to circle a number, you choose 5, and I ask you for the rest of the digits, i.e. 33304 (note, the order does not matter here). So, I know that the numerical root stays the same, so I find it for your digits, 3+3=6, 6+3=9, 9+4=13, 1+3=4 (as you might already see, this result is obtained when we subtract 9 from 13). So, the numerical root is 4, and I need to add 5 to get 9, hence 5 is the circled digit!

Reference:

Matematicheskie chudesa i tajny, M. Gardner, published in 1986, Moscow. (work in translation)

Vigenère cipher, programming contest

Yesterday I was solving an interesting question that has been used on the Swedish Computer Science contest – a programming contest, in 2010, which probably is simple, but interesting because it emphasises sequences, et cetera.

The question introduced the Vigenére cipher in a classical way, with two disks containing letters of the English alphabet. In the beginning, we know several things about the encrypted text, which are to help us when we are going to crack the message.
bokstavssnurra

  • The disks might have different number configurations, i.e. there is still a shift, which is unknown.
  • In order to “make it harder” for the enemy, each time we have obtained a letter, we continue by using a new shift, and this shift is increased by a constant value.
  • Fortunately, we get to know that each message contains the word “HEJ” – a Swedish word for “hello”, which might be used as  “bye”, I think.

Also, we get some examples as well, for instance:

Example 1:
Encrypted text: LRIJOUZRIYAQIRAG
Message: HEJVITARENFIKANU – means let’s take a “fika”

Example 2:
Encrypted text: GCGDJJI
Message: HEJHOPP – hello in an optimistic manner

There is also an example of this sequence,in Example 1, which is tells us that the difference is 9, 12, 15, 18… (common difference 3).

I’m solving this using a recurrence, and I’m not simplifying this arithmetic progression in any way, I just add d all the time.

The code below has passed all their tests, which are located at the end of this post.

        static void Main(string[] args)
        {
            /* 
             * Copyright (C) 2013 Artem Los,
             * All rights reserved.
             * 
             * This code-snippet can be found at: 
             *      http://clizware.net/
             */

            string alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

            Console.Write("Enter the message: ");

            string message = Console.ReadLine();

            int H = alphabet.IndexOf("H");
            int E = alphabet.IndexOf("E");
            int J = alphabet.IndexOf("J");

            int dA = mod(alphabet.IndexOf(message[0]) - H, alphabet.Length);
            int dB = mod(alphabet.IndexOf(message[1]) - E, alphabet.Length);
            int dC = mod(alphabet.IndexOf(message[2]) - J, alphabet.Length);

            int init1 = dB - dA;
            int init2 = dC - dB;

            int dConst = init2 - init1;
            int dPrev = dC;

            Console.Write("Output message: HEJ");
            for (int i = 3; i < message.Length; i++)
            {
                init2 += dConst;
                dPrev = mod(dPrev + init2, alphabet.Length);

                int X = alphabet.IndexOf(message[i]);
                Console.Write(alphabet[mod(X - dPrev, alphabet.Length)]);
            }

            Console.ReadLine();
        }

        static int mod(int n, int b)
        {
            return n - b * (int)Math.Floor((double)n / b);
        }
    }

Example 1
RIPIWDUXRS
HEJSOVERNI

Example 2
IGNUFAKPXYVSF
HEJNUKOMMERDE

Example 3
PAJESQBIPOOPKAP
HEJKOMHITGENAST

Reference:
http://www.progolymp.se/Oldpage/arkiv/kval10.pdf
http://www.progolymp.se/Oldpage/arkiv/kvalsvar10.pdf

Privacy on the Internet

One of the topics that has been emphasised previous year is privacy – something that might turn into scarce in the nearest feature. In this article we are going to look at several factors, and investigate different aspects of this issue.

As we know, a lot of us like to share different events, emotions, what to eat, what to dress, with whom to break a relation, etc, on internet, using social networks. It has become some sort of trend during the past three years, and it seems to continue, despite campaigns that are consolidating people to stop using them, it is still more newly registered users every day. Probably, the term privacy has been vaporized, and if not, it might do that in future.

A lot of articles that support the idea that privacy is outdated, and that today everyone is more open might do that for several reasons. First, they are either convinced by this idea, or, they simply want to protect their business, and encourage more people to use it. Everything leads to profit, and this is understandable.

We have for instance seen discussions about how Google and other search companies collect information, which triggered a reaction of several people. Also, we have seen articles about Facebook, and how some people could lose their job because of things they wrote. But what everything leads to is the actual person. If that person would think about that what he writes, there would not have been a problem. This is probably not similar to when you search on internet, because you are not actually writing something in public, but, you are still giving away a lot of information, which later will be used to decide what advertisement you should see when searching. This is not necessarily wrong, because why should we see an article about politics of a country, when you actually were searching for cheep journeys. However, at some point, it might feel a bit creepy!

I think we should keep in mind that internet is a tool, which everyone should be able to use, and in the same time consider the consequences of what they do (write, publish). Internet is amazing; the way we can communicate has contributed to developments of, for instance, the English language, and also other languages. The ability to work with people on the other side of the globe, share ideas; simply – contribute to a better feature. Internet is a place that everyone should enjoy to take a part of, but in the same time, be able to understand that there will always be those who abuse it – the bad guys,  as with any innovation in the world!

Software Protector [machine locking]

Software Protector [feature locking]

Finally, a demo of how you might implement feature locking into your application has been released by SKGL project December 28, 2012. This tutorial consist of a video, a demo website, http://dtc.clizware.net/Home.aspx, and source code, http://skgl.codeplex.com/releases/view/99637. Below, some screenshots:

The application

dtc2dtc1

The website

dtc3

The video

Finding polynomial, given one output

Sometimes, we can get a question like: Find a polynomial, such that.

f(7)=89183, 0 leq a_i < 7

Basically, the question asks us for the polynomial that will give as 89183, given that the coefficients are less than 7 and bigger than or equal to 0. Let’s illustrate this:

f(7)=a*7^5+b*7^4+c*7^3+d*7^2+e*7^1+f

Please consider that there might be more or less coefficients, this is just to facilitate the interpretation.

Probably, you might already see, that the number 89183 is in radix 10, and the number, using the coefficients, is in radix 7(abcdef)_7. When we used our polynomial to obtain the value of it, when x=7, we actually converted a number to radix 10.

Therefore, if you convert the result we got in radix 10 to radix 7, the number we get is the answer to this polynomial problem!

89183_1_0=521003_7

Now, we use these coefficients to construct the polynomial:

f(x)=5x^5+2x^4+x^3+3

Conclusion:

f(x)=y
y_x=(a_na_n_-_1...a_1a_0)_x

where a_i are the coefficients of the polynomial.

/Artem

Page 2 of 9:« 1 2 3 4 5 »Last »