Suppose a person is doing a sophisticated job with no haram at all, but he has got that job through fraud like bribing. He has to give bribe to some officers yearly in order to remain in the job. But his job is not at all haram. And he is performing his job with integrity. In order to supply bread and butter for his family members, he has to perform this bribing activity (no option for him).
With this background, he performs a charity of 4% of his income (not of saving but income) in order to rise in the eyes of Allah.
Will Allah consider this sadaquah and a righteous deed, as money is coming out of job which he has got through bribe.
Note:- He hasn't taken any bribe or performed any job which is haram.