hash – Will a recursive sha256 run over all 2^256 inputs before a collision?

Will a recursive sha256 run over all 2^256 inputs before a collision?

Here’a a python program showing my question – will this loop for 2^256 times – given endless memory or will it terminate before – if so when?

import hashlib

# start with 0
input = (0).to_bytes(32, byteorder="little", signed=False)

# dictionary to detect hash collisions - yes, this will eat up ALL memory
hit = {}

print ("first input:" + input.hex())

while (1):
    hash = hashlib.sha256(input).digest()
    # do we have a collision?
    assert (hash not in hit), "Collision!"
    # store current hash

    print ("Hash: " + hash.hex())

    # try again with the hash output as input

assembly – How do I detect the side of collision?

I got a simple method of detecting collision between two objects. The next step is to figure out what side of the hitbox was hit so I know whether I need to push the other object back in X or Y axis. I am using 6502 assembly to keep things simple. This means that some modern methods are too slow. Here is some known information about the objects:

  • object X/Y positions
  • object A begin above/below and to left/right of object B
  • object X/Y speeds
  • hitbox top/left/bottom/right bound distance from object position
  • the amount of hitbox overlap in X/Y axis

Also there should be a way to detect if a corner is hit so that can be treated differently (eg. when hitting top corner favor pushing object on top of the other object, landing on it, rather than pushing the object aside and falling)

collision detection – Sliding movement on a grid

I’m trying to implement “sliding” movement on a simple grid, where the movement vector is continuous (floating point direction) but the grid is discrete (boolean blocked or open on integer axes).

The “destination” tile is found by adding the rounded movement vector to the current tile. That part is naive and works well enough.

For example, here:

  • blue is the current (source) tile
  • the yellow arrow is the movement vector
  • green is the destination tile

enter image description here

But this movement ends up being restrictive and I’d like to enable “sliding” to approximate player intent. My goal is that if the destination tile is blocked, the “next best” tile is used instead, provided it is available. I don’t know how to calculate that.

As you can see, the naive destination tile (where the yellow arrow lands) is blocked. As a result, I’d like to pick the green tile above as the destination tile.

enter image description here

However, crossing a diagonal should be allowed either, so the following case should result in the movement being blocked:

enter image description here

Finally, I’d like this algorithm to be as permissive as possible, so even the smallest component of the movement vector could win if no better alternative is found. For example, the movement should carry upwards in that case:

enter image description here

This sounds like a fairly simple problem and there may be existing algorithms for it, but I don’t know what it’s called, so I’m having trouble finding resources on it.

collision detection – “Blind” PathFinding for fleeing agent

I know there are plenty of algorithms for finding a path from A to B. There’s also a good few articles on how to avoid an enemy in a 2D space. I can’t find anything on escaping from an enemy in a blind 2D space. Here’s what i mean by “blind” 2D space.

1, The fleeing agent only knows its position in the grid and the enemy’s position.
2, I do not know how big the grid is.
3, I do not know where the walls or obstacles are.
4, If i want to check what’s directly next to me I have to “go” there, if my position changes it’s an empty space, else it’s a wall or an obstacle.

The goal is to avoid the chaser (enemy) for 1000 moves. I move 2x as fast therefore I get to make 1000 moves while the enemy can only make 500 (moves every 2nd turn). Further more i can only move in 4 directions; up, down, left, right. The enemy gets to move in diagonals too.

My first idea was to find a block or a cluster of blocks i could circle around. Well, didn’t work, by the time I found one the enemy caught me. Is there a way or an article describing this problem? Would appreciate any suggestions or articles sent my way.

opengl – 3d physics collision and keyboard interference

I have coded a convex hull collider using sat , everything works fine, and to test it i am using the keyboard to contorl a shape. I am experiencing an issue, when i try to push the shape against another i get an occasional interpenetration of the two shapes, this gives an unplkeasent effect. I have come to the conslusion that the problem is the keyboard and the game loop update. How can I solve this problem ?

physics – OBB vs rectangle/quad/plane with bounds collision detection/response

I am able to resolve collision between an OBB and a plane but can’t get it to work when I introduce some bounds on the plane size. I want to have the plane of width and height dimensions defined by a normal and a position.

The code for detecting/resolving is fairly simple if the plane doesn’t have any bounds:

function obbIntersectsPlane( obb, plane ) {
  let r = obb.size.x / 2 * Math.abs( dot( obb.right, plane.normal ) ) + 
          obb.size.y / 2 * Math.abs( dot( obb.up, plane.normal ) ) +
          obb.size.z / 2 * Math.abs( dot( obb.forward, plane.normal ) );
  let s = dot( plane.normal, obb.position ) - dot( plane.normal, plane.position );

  if ( Math.abs( s ) < r ) {
    return {
      overlap: r - s,
      vector: plane.normal

  return false;

collision detection – Intersection of thick line with a grid

There is a popular paper, and numerous examples, on how to efficiently perform collision detection for a line with a grid. However, I’m drawing up blanks on how to do the same thing but with a line that has thickness.

In my game, I’m considering adding projectiles that are not infinitly thin (for example, a giant slow-moving plasma ball), and I need to figure out which cells along a grid that it collides with. Initially I thought it’d be as simple as just using the Minkowski Sum method of adding the width/height of the projectile to each cell of the grid, and then treating the projectile as infinity thin line along a bloated-overlapping-grid, but that doesn’t look like it’s going to work with the existing algorithm.

Are there any other papers/algorithms that describe how to accomplish this? Or is there a way to modify the existing algorithm to accomplish this? Or are there any tricks to implementing this indirectly?

Will the Bitcoin network discredit a transaction if you do a simple transfer on a multi-sig after you found the collision on that address?

Stack Exchange Network

Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

How do you use custom collision on a skeletal mesh in UE4?

I have a vehicle rig that is a skeletal mesh that imports fine in to unreal but I was wondering how to use a mesh for collision on it. Normally you can just name the collision mesh with UCX_ in front of the name to do it but with skeletal meshes it makes you use a system called phat and I only see cubes/spheres/capsules for collision with that.

Godot – Collision for character teleportation

I’m currently working on a little game to discover Godot game engine.

It’s a Top-Down game and I want my character to be able to teleport through walls.

I thought to dupplicate my character’s collision box and to set its position to the teleportation’s position but I didn’t find a way to check if there is a collision to this new position.

Any advise?