A spinal code is the type of rateless code, which has been proved to be capacity- achieving over both a binary symmetric channel (BSC) and an additive white Gaussian noise (AWGN) channel. Rateless spinal codes employ a hash function as a coding kernel to generate infinite pseudo-random symbols. A good hash function can improve the perfor- mance of spinal codes. In this paper, a lightweight hash function based on sponge structure is designed. A permutation function of registers is a nonlinear function. Feedback shift registers are used to improve randomness and reduce bit error rate (BER). At the same time, a pseudo-random number generator adopts a layered and piecewise combination mode, which further encrypts signals via the layered structure, reduces the correlation between input and output values, and generates the piecewise random numbers to compensate the shortcoming of the mixed linear congruence output with fixed length. Simulation results show that the designed spinal code with the lightweight hash function outperforms the original spinal code in aspects of the BER, encoding time and randomness.