**"Math"**

## Hash Collision Probability

*By Shay Ben Moshe On March 28, 2012 · 2 Comments · In General*

One of the problems of hash functions is collisions, they cause some security vulnerabilities which won’t be discussed in this article.

In this article I would like to find some approximations concerning collisions.

Probability for a collision

Let \(\mathbf{M}\) be the size of the range (i.e. for md5 it is \(2^{128}\) since md5 returns 128 [...]

## Generalized Random Sub Array Algorithm

*By Shay Ben Moshe On November 2, 2011 · Leave a Comment · In Algorithms*

After discussing with some friends on StartupSeeds, I came up with a generalized random sub array algorithm.

This algorithm can be implemented with different data-structures, and it’s complexity is \(O(n)\) or \(O(k\log\space k)\) for 2 specific implementations.

We need a data-structure that can contain integers.

It must have 2 methods which are add [...]

## Generating Random Sub Array

*By Shay Ben Moshe On October 9, 2011 · Leave a Comment · In Algorithms*

Today I came across an algorithmic problem.

I wanted to choose a random sub array of size \(k\) from an array of size \(n\), while maintaining its order.

For example, if we have the array \(\{0,1,2,3,4,5,6,7,8,9\}\) a possible result for \(k=4\) is the array \(\{1,4,7,9\}\).

I came up with an algorithm with average [...]

## Phrase Based Password Entropy

*By Shay Ben Moshe On September 18, 2011 · 4 Comments · In General*

Yesterday I have published an article about password entropy.

Today I would like to discuss the entropy of a phrase based password.

Phrase Based Password

A phrase based password is a password assembled from several easy to remember and spell words, delimited by spaces.

As a result, such passwords are very [...]

## Password Entropy

*By Shay Ben Moshe On September 17, 2011 · 22 Comments · In General*

A common and easy way to estimate the strength of a password is its entropy.

The entropy is given by \(H = L \log_2{N}\) where \(L\) is the length of the password and \(N\) is the size of the alphabet, and it is usually measured in bits.

The entropy measures the number of [...]

## Quicksort Average Case Time Complexity

*By Shay Ben Moshe On July 31, 2011 · 5 Comments · In Algorithms*

In this article I would like to analyze the performance of one of the best sorting algorithms I know: Quicksort.

When I first saw the algorithm I was also told that on average it has \(O(n\log n)\) time complexity, however I never saw a proof until today.

Today I read

## Newton’s Method

*By Shay Ben Moshe On June 29, 2011 · 1 Comment · In Algorithms*

Newton’s method is a method for finding approximations to the roots of a given function.

The method itself is very simple, you give an initial guess of the root, \(x_0\), and calculate further values using the following equation: \(x_{n+1}=x_n-\frac{f’(x_n)}{f(x_n)}\).

Generally, each term in the sequence is more accurate in comparison to the previous terms.

[...]

## Square Root Algorithm

*By Shay Ben Moshe On May 22, 2011 · 3 Comments · In Algorithms*

A few days ago I thought of an algorithm to calculate square roots. In this article I would like to introduce my algorithm.

I should mention that this algorithm probably exists.

First of all, my algorithm can only find roots between a specific range (for example \(0\) to \(1\)), thus we need to decrease [...]

### Recent Comments

- liggywoth on Password Entropy
- liggywoth on Password Entropy
- Stephen Long on Password Entropy
- PHP Native Array vs. SPL SplFixedArray vs. ‘SPL Arraylist’ | Anthony's Blog on PHP’s native array vs SplFixedArray performance
- Shay Ben Moshe on Password Entropy

### Categories