Implement a function which takes a string, and returns its hash value.

Algorithm steps:

* `a` := sum of the ascii values of the input characters
* `b` := sum of every difference between the consecutive characters of the input (second char minus first char, third minus second, ...)
* `c` := (`a` OR `b`) AND ((NOT `a`) shift left by 2 bits)
* `d` := `c` XOR (32 * (`total_number_of_spaces` + 1))
* return `d`

**Note**: OR, AND, NOT, XOR are bitwise operations.

___

### Examples

```
input = "a"
a = 97
b = 0
result = 64

input = "ca"
a = 196
b = -2
result = -820
```

___

Give an example why this hashing algorithm is bad?

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def string_hash(s):
	

Solutions:
def string_hash(s):
	a = sum((ord(c) for c in s))
	b = sum((ord(b) - ord(a) for (a, b) in zip(s, s[1:])))
	c = (a | b) & ~a << 2
	return c ^ 32 * (s.count(' ') + 1)


def string_hash(s):
	(a, b) = (sum((ord(x) for x in s)), sum((ord(y) - ord(x) for (x, y) in zip(s, s[1:]))))
	return (a | b) & ~a << 2 ^ 32 * (s.count(' ') + 1)


def string_hash(s):
	a = sum((ord(c) for c in s))
	b = ord(s[-1]) - ord(s[0]) if s else 0
	c = (a | b) & ~a << 2
	return c ^ 32 * (s.count(' ') + 1)


def string_hash(s):
	ascii_sum = sum([ord(i) for i in s])
	ascii_difference = sum([ord(s[j + 1]) - ord(i) for (j, i) in enumerate(s[:-1])])
	shifted = (ascii_sum | ascii_difference) & ~ascii_sum << 2
	return shifted ^ 32 * (s.count(' ') + 1)


def string_hash(s):
	xs = list(map(ord, s))
	a = sum(xs)
	b = sum((y - x for (x, y) in zip(xs, xs[1:])))
	c = (a | b) & ~a << 2
	d = c ^ 32 * (s.count(' ') + 1)
	return d


def string_hash(s):
	return (sum([ord(i) for i in s]) | sum([ord(s[j + 1]) - ord(i) for (j, i) in enumerate(s[:-1])])) & ~sum([ord(i) for i in s]) << 2 ^ 32 * (s.count(' ') + 1)


def string_hash(s: str) -> int:
	a = sum((ord(c) for c in s))
	n = s.count(' ')
	b = ord(s[-1]) - ord(s[0]) if s else 0
	c = (a | b) & ~a << 2
	d = c ^ n + 1 << 5
	return d


def string_hash(s):
	a = sum((ord(c) for c in s))
	b = sum((ord(x) - ord(y) for (x, y) in zip(s[1:], s)))
	c = (a | b) & ~a << 2
	return c ^ s.count(' ') + 1 << 5