Sync two registry questions

The purpose is:
to sync some images from one registry to another registry.
for example, sync some image from docker hub to local registry

The process flow is:

1.get image manifest from registry A using API: GET registry_A/v2//manifests/
2. get the blobs’ digest
3. check whether the blob is exist in registry B or not using API: HEAD registry_B/v2//blobs/
4. if the blob is not exist in registry B, then:
4.1 pull the blob from registry_A using API: GET registry_A/v2//blobs/
4.2 push the blob to registry_B using API: POST registry_B/v2//blobs/uploads/
5. put the image manifest to registry B,using API: PUT registry_B/v2//manifests/

is the process correct?
the risk is that if two registry generate digest using different algorithm or using different parameters,
then the two registry’s digest be not identical.

The question is :
the manifest’s and blob layer’s digest are always same within the two registry if the images are same?